0% found this document useful (0 votes)
42 views3 pages

Base de Datos

The document provides code to create three modules in VBA. The first module contains code to copy data from cells on the "MATRICULA" sheet to cells on the "BD" sheet when a form is submitted, with validation to check for empty fields. The second module contains code to clear the values in the form fields after submission. The third module contains code to delete the last row of data on the "BD" sheet.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views3 pages

Base de Datos

The document provides code to create three modules in VBA. The first module contains code to copy data from cells on the "MATRICULA" sheet to cells on the "BD" sheet when a form is submitted, with validation to check for empty fields. The second module contains code to clear the values in the form fields after submission. The third module contains code to delete the last row of data on the "BD" sheet.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

PRIMER MODULO

COLOCAR LO SIGUIENTE EN EL PRIMER MODULO:

Sub grabar()

If Range("D7").Value = Empty Or Range("F7").Value = Empty Or Range("D9").Value = Empty Or


Range("F9").Value = Empty Or Range("D11").Value = Empty Or Range("F11").Value = Empty Then

MsgBox ("Error. Todos los campos deben estar diligenciados")

Exit Sub

End If

Aplication.ScreenUpdating = False

Sheets("BD").Select

Range("A3").EntireRow.Insert

Sheets("MATRICULA").Select

'Nombre

Range("D7").Copy

Sheets("BD").Select

Range("B3").PasteSpecial xlPasteValues

Sheets("MATRICULA").Select

'Apellido

Range("F7").Copy

Sheets("BD").Select

Range("C3").PasteSpecial xlPasteValues

Sheets("MATRICULA").Select

'D. Identidad

Range("D9").Copy
Sheets("BD").Select

Range("D3").PasteSpecial xlPasteValues

Sheets("MATRICULA").Select

'Telefono

Range("F9").Copy

Sheets("BD").Select

Range("E3").PasteSpecial xlPasteValues

Sheets("MATRICULA").Select

'Direccion

Range("D11").Copy

Sheets("BD").Select

Range("G3").PasteSpecial xlPasteValues

Sheets("MATRICULA").Select

'Edad

Range("F11").Copy

Sheets("BD").Select

Range("H3").PasteSpecial xlPasteValues

Sheets("MATRICULA").Select

End Sub

NUEVO MODULO:

Sub limpiar()

Range("D7").Value = Empty
Range("F7").Value = Empty

Range("D9").Value = Empty

Range("F9").Value = Empty

Range("D11").Value = Empty

Range("F11").Value = Empty

End Sub

NUEVO MODULO

Sub Eliminar()

Sheets("BD").Select

Range("A3").EntireRow.Delete

End Sub

You might also like