Diseño del formulario
Diseño en la hoja1
Private Sub CmdNuevo_Click()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox1.Text = ""
Me.OptionButton1.Value = True
TextBox1.SetFocus
End Sub
Private Sub CmdGrabar_Click()
Dim xfil As Integer
If Len(TextBox1.Text) <> 11 Then
MsgBox "Verificar el Nº de Ruc ", vbInformation, "Aviso !!!!"
TextBox1.SetFocus
Exit Sub
End If
Range("A6").Activate
xfil = ActiveCell.CurrentRegion.Rows.Count
ActiveCell.Offset(xfil, 0) = TextBox1.Text
ActiveCell.Offset(xfil, 1) = TextBox2.Text
ActiveCell.Offset(xfil, 2) = TextBox3.Text
ActiveCell.Offset(xfil, 3) = ComboBox1.Text
If CheckBox1.Value = True Then
ActiveCell.Offset(xfil, 4) = "Lima"
Else
ActiveCell.Offset(xfil, 4) = "Provincia"
End If
If OptionButton1.Value = True Then
ActiveCell.Offset(xfil, 5) = "Bueno"
Else
ActiveCell.Offset(xfil, 5) = "Excelente"
End If
ActiveCell.Offset(xfil, 6) = TextBox4.Text
End Sub
Private Sub CmdSalir_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
ComboBox1.RowSource = "ListaDistritos"
End Sub