Вы находитесь на странице: 1из 14

Private Sub cmd_finalizar_Click()

MsgBox "Finalizando aplicación", vbInformation, "Formularios"

End

End Sub

Private Sub cmd_modificar_Click()

Dim CODIGO_MODIFICAR As String

Dim AUX_MODIFICAR As Integer

CODIGO_MODIFICAR = UCase(InputBox("Ingrese codigo a modificar", "Formularios"))

For AUX_MODIFICAR = 3 To 1000

If Cells(AUX_MODIFICAR, 2) = CODIGO_MODIFICAR Then

Exit For

End If

Next

MsgBox (AUX_MODIFICAR)

txt_paterno.Text = Cells(AUX_MODIFICAR, 3)

txt_materno.Text = Cells(AUX_MODIFICAR, 4)

txt_nombres.Text = Cells(AUX_MODIFICAR, 5)

cbo_curso.Text = Cells(AUX_MODIFICAR, 6)

cbo_turno.Text = Cells(AUX_MODIFICAR, 7)

End Sub

Private Sub cmd_registrar_Click()

Application.Worksheets("Registro").Select
Range("B2").Select

Dim codigo As String

Dim aux_fila As Integer

codigo = UCase(Left(txt_paterno.Text, 3) & Right(txt_materno.Text, 2) & Mid(txt_nombres.Text, 2,


1))

While ActiveCell.Value <> Empty

ActiveCell.Offset(1, 0).Select

Wend

ActiveCell.Value = codigo

ActiveCell.Offset(0, 1).Value = UCase(txt_paterno.Text)

ActiveCell.Offset(0, 2).Value = UCase(txt_materno.Text)

ActiveCell.Offset(0, 3).Value = UCase(txt_nombres.Text)

ActiveCell.Offset(0, 4).Value = UCase(cbo_curso.Text)

ActiveCell.Offset(0, 5).Value = UCase(cbo_turno.Text)

MsgBox "Preparando nuevo registro", vbInformation, "Formularios"

Call LIMPIEZA

'Application.Worksheets("REGISTRO").Select

'Range("b2").Select

'MsgBox "Grabando datos", vbInformation, "Formularios"

'Dim codigo As String

'codigo = UCase(Left(txt_paterno.Text, 3) & Right(txt_materno.Text, 2) & Mid(txt_nombres.Text,


2, 1))

'While ActiveCell.Value <> Empty

'ActiveCell.Offset(1, 0).Select

'Wend
'AQUI YA PASO EL VALOR DE CODIGO A LA CELDA ACTIVA

'ActiveCell.Value = codigo

'SI EL CODIGO INGRESADO ES IGUAL AL VALOR DE LA CELDA ACTIVADA (SI EL CODIGO YA EXISTE)

'If codigo = ActiveCell.Value Then

'ActiveCell.Value = Empty

'MsgBox "Codigo existente", vbInformation, "Formularios"

'Call LIMPIEZA

' Else

'ActiveCell.Offset(0, 1).Value = UCase(txt_paterno.Text)

' ActiveCell.Offset(0, 2).Value = UCase(txt_materno.Text)

'ActiveCell.Offset(0, 3).Value = UCase(txt_nombres.Text)

'ActiveCell.Offset(0, 4).Value = UCase(cbo_curso.Text)

'ActiveCell.Offset(0, 5).Value = UCase(cbo_turno.Text)

' MsgBox "Preparando nuevo registro", vbInformation, "Formularios"

'Call LIMPIEZA

'End If

End Sub

Private Sub UserForm_Activate()

'LLENAR CURSOS

cbo_curso.AddItem "Excel Básico"

cbo_curso.AddItem "Excel Intermedio"

cbo_curso.AddItem "Excel Avanzado"

'LLENAR TURNOS

cbo_turno.AddItem "L-V"

cbo_turno.AddItem "Sáb"
cbo_turno.AddItem "Dom"

End Sub

Sub LIMPIEZA()

txt_paterno.Text = Empty

txt_materno.Text = Empty

txt_nombres.Text = Empty

cbo_curso.ListIndex = -1

cbo_turno.ListIndex = -1

txt_paterno.SetFocus

End Sub

FORMULARIO INGRESO

'PARA DECLARAR VARIABLES DE FORMA GLOBAL

Option Explicit

Dim AUX_MODIFICAR As Integer

Private Sub cmd_buscar_Click()

Application.Worksheets("Registro").Select

Dim CODIGO_MODIFICAR As String

'Dim AUX_MODIFICAR As Integer

CODIGO_MODIFICAR = UCase(InputBox("Ingrese codigo a buscar", "Formularios"))

For AUX_MODIFICAR = 3 To 1000

If Cells(AUX_MODIFICAR, 2) = CODIGO_MODIFICAR Then

Exit For

End If
Next

MsgBox "Mostrando datos", vbInformation, "Formularios"

'MsgBox (AUX_MODIFICAR)

txt_paterno.Text = Cells(AUX_MODIFICAR, 3)

txt_materno.Text = Cells(AUX_MODIFICAR, 4)

txt_nombres.Text = Cells(AUX_MODIFICAR, 5)

cbo_curso.Text = Cells(AUX_MODIFICAR, 6)

cbo_turno.Text = Cells(AUX_MODIFICAR, 7)

End Sub

Private Sub cmd_eliminar_Click()

Application.Worksheets("Registro").Select

Cells(AUX_MODIFICAR, 2).Select

Selection.EntireRow.Delete

MsgBox "Se eliminó los datos", vbInformation, "Formulario"

Call LIMPIEZA

End Sub

Private Sub cmd_finalizar_Click()

MsgBox "Finalizando aplicación", vbInformation, "Formularios"

End

End Sub

Private Sub cmd_guardar_Click()

Cells(AUX_MODIFICAR, 3) = UCase(txt_paterno.Text)

Cells(AUX_MODIFICAR, 4) = UCase(txt_materno.Text)

Cells(AUX_MODIFICAR, 5) = UCase(txt_nombres.Text)
Cells(AUX_MODIFICAR, 6) = UCase(cbo_curso.Text)

Cells(AUX_MODIFICAR, 7) = UCase(cbo_turno.Text)

MsgBox "Se ha guardado la modificación", vbInformation, "Formularios"

End Sub

Private Sub cmd_registrar_Click()

Application.Worksheets("Registro").Select

Range("B2").Select

Dim codigo As String

Dim aux_fila As Integer

codigo = UCase(Left(txt_paterno.Text, 3) & Right(txt_materno.Text, 2) & Mid(txt_nombres.Text, 2,


1))

While ActiveCell.Value <> Empty

ActiveCell.Offset(1, 0).Select

Wend

MsgBox "Se están guardando los datos", vbInformation, "Formulario"

ActiveCell.Value = codigo

ActiveCell.Offset(0, 1).Value = UCase(txt_paterno.Text)

ActiveCell.Offset(0, 2).Value = UCase(txt_materno.Text)

ActiveCell.Offset(0, 3).Value = UCase(txt_nombres.Text)

ActiveCell.Offset(0, 4).Value = UCase(cbo_curso.Text)

ActiveCell.Offset(0, 5).Value = UCase(cbo_turno.Text)

MsgBox "Preparando nuevo registro", vbInformation, "Formularios"

Call LIMPIEZA
'Application.Worksheets("REGISTRO").Select

'Range("b2").Select

'MsgBox "Grabando datos", vbInformation, "Formularios"

'Dim codigo As String

'codigo = UCase(Left(txt_paterno.Text, 3) & Right(txt_materno.Text, 2) & Mid(txt_nombres.Text,


2, 1))

'While ActiveCell.Value <> Empty

'ActiveCell.Offset(1, 0).Select

'Wend

'AQUI YA PASO EL VALOR DE CODIGO A LA CELDA ACTIVA

'ActiveCell.Value = codigo

'SI EL CODIGO INGRESADO ES IGUAL AL VALOR DE LA CELDA ACTIVADA (SI EL CODIGO YA EXISTE)

'If codigo = ActiveCell.Value Then

'ActiveCell.Value = Empty

'MsgBox "Codigo existente", vbInformation, "Formularios"

'Call LIMPIEZA

' Else

'ActiveCell.Offset(0, 1).Value = UCase(txt_paterno.Text)

' ActiveCell.Offset(0, 2).Value = UCase(txt_materno.Text)

'ActiveCell.Offset(0, 3).Value = UCase(txt_nombres.Text)

'ActiveCell.Offset(0, 4).Value = UCase(cbo_curso.Text)

'ActiveCell.Offset(0, 5).Value = UCase(cbo_turno.Text)

' MsgBox "Preparando nuevo registro", vbInformation, "Formularios"

'Call LIMPIEZA

'End If
End Sub

Private Sub UserForm_Activate()

'LLENAR CURSOS

cbo_curso.AddItem "Excel Básico"

cbo_curso.AddItem "Excel Intermedio"

cbo_curso.AddItem "Excel Avanzado"

'LLENAR TURNOS

cbo_turno.AddItem "L-V"

cbo_turno.AddItem "Sáb"

cbo_turno.AddItem "Dom"

End Sub

Sub LIMPIEZA()

txt_paterno.Text = Empty

txt_materno.Text = Empty

txt_nombres.Text = Empty

cbo_curso.ListIndex = -1

cbo_turno.ListIndex = -1

txt_paterno.SetFocus

End Sub

FORMULARIO LOGIN

Private Sub cmd_verificar_Click()

Dim USUARIO As String

Dim CONTRASENA As String


USUARIO = UCase(txt_usuario.Text)

CONTRASENA = txt_contrasena.Text

If USUARIO = "ADMIN" And CONTRASENA = "1234" Then

MsgBox "BIENVENIDO AL SISTEMA", vbInformation, "FORMULARIOS"

txt_usuario.Text = Empty

txt_contrasena.Text = Empty

frm_login.Hide

frm_ingreso.Show

Else

MsgBox "DATOS INCORRECTOS", vbCritical, "FORMULARIOS"

End

End If

End Sub

Private Sub UserForm_Click()

End Sub

Option Explicit

Dim num1 As Integer

Dim num2 As Integer

Dim operador As String

Private Sub cmd_ingresar_Click()

Application.Worksheets("CALCULADORA").Select

Range("B2").Select

While ActiveCell.Value <> Empty

ActiveCell.Offset(1, 0).Select
Wend

ActiveCell.Value = num1

ActiveCell.Offset(0, 1).Value = operador

ActiveCell.Offset(0, 2).Value = num2

ActiveCell.Offset(0, 3).Value = txt_resultado.Text

End Sub

Private Sub cmd_nuevo_Click()

txt_dato1 = Empty

txt_dato2 = Empty

txt_resultado = Empty

opt_sumar.Value = False

opt_restar.Value = False

opt_multiplicar.Value = False

opt_dividir.Value = False

End Sub

Private Sub cmd_salir_Click()

MsgBox "Saliendo de la calculadora", vbInformation, "Calculadora"

End

End Sub

Private Sub opt_sumar_Click()

num1 = Val(txt_dato1.Text)

num2 = Val(txt_dato2.Text)

If opt_sumar = True Then

txt_resultado = num1 + num2


operador = "+"

End If

End Sub

Private Sub opt_restar_Click()

num1 = Val(txt_dato1.Text)

num2 = Val(txt_dato2.Text)

If opt_restar = True Then

txt_resultado = num1 - num2

operador = "-"

End If

End Sub

Private Sub opt_multiplicar_Click()

num1 = Val(txt_dato1.Text)

num2 = Val(txt_dato2.Text)

If opt_multiplicar = True Then

txt_resultado = num1 * num2

operador = "*"

End If

End Sub

Private Sub opt_dividir_Click()

num1 = Val(txt_dato1.Text)

num2 = Val(txt_dato2.Text)

If num2 <> 0 And opt_dividir = True Then

txt_resultado = num1 / num2

operador = "/"
Else

MsgBox "ERROR", vbCritical, "Calculadora"

End If

End Sub

Sub VALORES()

num1 = Val(txt_dato1.Text)

num2 = Val(txt_dato2.Text)

End Sub

Private Sub cmd_guardar_Click()

Application.Worksheets("REGISTRO AUXILIAR").Select

Range("B3").Select

Dim CODIGO As String

Dim AUX_SECCION As String

Dim PROMEDIO As Integer

Dim CONDICION As String

CODIGO = UCase(Left(txt_paterno.Text, 2) & rigth(txt_nombre.Text, 3))

If opt_a.Value = True Then

AUX_SECCION = "A"

Else

If opt_b.Value = True Then

AUX_SECCION = "B"

Else

If opt_c.Value = True Then


AUX_SECCION = "C"

End If

End If

End If

PROMEDIO = Round(Val(txt_p1.Text + txt_p2.Text + txt_examen.Text) / 3, 0)

If Val(txt_p1.Text) >= 14 And Val(txt_p2.Text >= 14) Then

CONDICION = "PROMOVIDO"

Else

CONDICION = "REPITENTE"

End If

While ActiveCell.Value <> Empty

ActiveCell.Offset(1, 0).Select

Wend

ActiveCell.Value = CODIGO

ActiveCell.Offset(0, 1).Value = UCase(txt_paterno.Text & " " & txt_materno.Text)

ActiveCell.Offset(0, 2).Value = UCase(txt_nombre.Text)

ActiveCell.Offset(0, 3).Value = UCase(cbo_grado.Text)

ActiveCell.Offset(0, 4).Value = UCase(AUX_SECCION)

ActiveCell.Offset(0, 5).Value = UCase(cbo_curso.Text)

ActiveCell.Offset(0, 6).Value = UCase(txt_p1.Text)

ActiveCell.Offset(0, 7).Value = UCase(txt_p2.Text)

ActiveCell.Offset(0, 8).Value = UCase(txt_examen.Text)

ActiveCell.Offset(0, 9).Value = UCase(PROMEDIO)


End Sub

Private Sub cmd_salir_Click()

MsgBox "Cerrando programa de registro", vbInformation, "REGISTRO"

End

End Sub

Private Sub UserForm_Activate()

'Lista de cursos

cbo_curso.AddItem "Lenguaje"

cbo_curso.AddItem "Matemática"

cbo_curso.AddItem "Inglés"

cbo_curso.AddItem "Raz. Verbal"

cbo_curso.AddItem "Raz. Matemático"

cbo_grado.AddItem "Primero"

cbo_grado.AddItem "Segundo"

cbo_grado.AddItem "Tercero"

cbo_grado.AddItem "Cuarto"

cbo_grado.AddItem "Quinto"

End Sub

Private Sub cmd_Acceder_Click()

MsgBox ("Bienvenido a la Aplicación")

frm_login.Show

End Sub

Вам также может понравиться