You are on page 1of 2

Dim F As Integer

Private Sub CommandButton1_Click()


Sheets("PROVEEDORES").Cells(F, 2) = Txt_codigo.Text
Sheets("PROVEEDORES").Cells(F, 3) = TextBox1.Text
Sheets("PROVEEDORES").Cells(F, 4) = TextBox2.Text
Sheets("PROVEEDORES").Cells(F, 5) = TextBox3.Text
Sheets("PROVEEDORES").Cells(F, 6) = TextBox4.Text
Sheets("PROVEEDORES").Cells(F, 7) = IIf(OPT1.Value, OPT1.Caption, IIf(OPT2.Value,
OPT2.Caption, OPT3.Caption))
Sheets("PROVEEDORES").Cells(F, 8) = TextBox5.Text
Sheets("PROVEEDORES").Cells(F, 9) = TextBox6.Text
End Sub

Private Sub CommandButton3_Click()


End
End Sub

Private Sub Txt_codigo_Click()


F=4
Do While Sheets(2).Cells(F, 2) <> ""
If Txt_codigo.Text = Sheets(2).Cells(F, 2) Then
TextBox1.Text = Sheets(2).Cells(F, 3)
TextBox2.Text = Sheets(2).Cells(F, 4)
TextBox3.Text = Sheets(2).Cells(F, 5)
TextBox4.Text = Sheets(2).Cells(F, 6)
Select Case Sheets(2).Cells(F, 7)
Case "LIQUIDO": OPT1.Value = True
Case "SOLIDO": OPT2.Value = True
Case "POLVO": OPT3.Value = True
End Select
TextBox5.Text = Sheets(2).Cells(F, 8)
TextBox6.Text = Sheets(2).Cells(F, 9)

Exit Sub
End If
F=F+1
Loop
End Sub

Private Sub UserForm_Initialize()


FF = 4
Do While Sheets(2).Cells(FF, 2) <> ""
Txt_codigo.AddItem Sheets(2).Cells(FF, 2)
FF = FF + 1
Loop
End Sub

You might also like