Boa tarde!!
Considerando seu excemplo, apague todos os códigos dentro dele e cole esses...
Public myRow As Long
Private Sub cmbcliente_Click()
myRow = Application.Match(Me.cmbcliente.Value, Sheets("Plan1").Range("A:A"), 0)
Me.txtcidade.Value = Application.Index(Sheets("Plan1").Columns(2), myRow)
Me.txtbairro.Value = Application.Index(Sheets("Plan1").Columns(3), myRow)
Me.txttelefone.Value = Application.Index(Sheets("Plan1").Columns(4), myRow)
End Sub
Private Sub CommandButton1_Click()
NameOrig = txtcidade.Value
With Worksheets("Plan1").Range("A:A")
.Cells(myRow, 2).Value = txtcidade.Value
.Cells(myRow, 3).Value = txtbairro.Value
.Cells(myRow, 4).Value = txttelefone.Value
End With
'Unload Me
End Sub
Private Sub UserForm_Initialize()
For Each c In Worksheets("Plan1").Range("A2", Range("A65000").End(xlUp))
Me.cmbcliente.AddItem c.Value
Next c
End Sub
Att
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 03/10/2014 9:46 am