Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub TextBox3_AfterUpdate()
If Not IsNumeric(TextBox3) Then
MsgBox " debe ingresar solo datos numericos", vbCritical, "Aviso"
Cancel = True
TextBox3.SelStart = 0
TextBox3.SelLength = Len(TextBox2)
End If
End Sub
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
ComboBox1.Clear
Sheets("maestro").Select
Range("A2").Select
While ActiveCell <> Empty
ComboBox1.AddItem ActiveCell
ActiveCell.Offset(1, 0).Select
Wend
Me.TextBox4.Value = Now
ComboBox2.Clear
Sheets("maestro").Select
Range("e2").Select
While ActiveCell <> Empty
ComboBox2.AddItem ActiveCell
ActiveCell.Offset(1, 0).Select
Wend
ComboBox3.Clear
Sheets("maestro").Select
Range("g2").Select
While ActiveCell <> Empty
ComboBox3.AddItem ActiveCell
ActiveCell.Offset(1, 0).Select
Wend
End Sub
Private Sub CommandButton1_Click()
Sheets("movi").Activate
If TextBox1 = "" Or TextBox2 = "" Or TextBox3 = "" Or TextBox4 = "" Then
MsgBox "Está dejando campos requeridos vacios favor complete", vbInformation, "Error de Captura"
TextBox1.SetFocus
Else
Range("A" & Cells.Rows.Count).End(xlUp).Offset(1).Select
ActiveCell = TextBox2.Value
ActiveCell.Offset(0, 1) = TextBox1.Value
ActiveCell.Offset(0, 2) = TextBox3.Value
ActiveCell.Offset(0, 3) = TextBox4.Value
ActiveCell.Offset(0, 5) = Me.ComboBox2.Text
ActiveCell.Offset(0, 6) = Me.ComboBox3.Text
MsgBox "Datos actualizados correctamente", vbInformation, "Almacen"
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
Me.TextBox4.Value = Now
TextBox1.Locked = True
TextBox2.Locked = True
TextBox3.Locked = True
TextBox4.Locked = True
Me.ComboBox1.SetFocus
End If
End Sub
Private Sub ComboBox1_Change()
Dim var2 As String
If ComboBox1 = "" Then
Else
CommandButton1.Locked = False
Sheets("maestro").Activate
If ComboBox1 = Empty Then
MsgBox "Para modificar primero seleccione proveedor", vbInformation, "Almacen"
ComboBox1.ListIndex = 0
ComboBox1.SetFocus
End If
If Me.ComboBox1.Text = Null Then
MsgBox "el dato no existe"
ComboBox1.ListIndex = 0
ComboBox1.SetFocus
End If
var2 = ComboBox1.Column(0)
Cells.Find(What:=ComboBox1.Value, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
If var2 = ActiveCell.Value Then
TextBox1.Value = ActiveCell.Value
TextBox2 = ActiveCell.Offset(0, 1)
TextBox1.Locked = True
TextBox2.Locked = True
TextBox3.Locked = False
TextBox4.Locked = False
End If
End If
End Sub