Ola Estou desenvolvendo um projeto em excel vba onde tenho um botao consultar.
Quando Jogo este codigo:
Private Sub UserForm_Activate()
'Dim Registros As Long
'Registros = Plan2.Range("A6553").End(xlUp).Row
'If Registros > 1 Then
'With Lstdecricao1
'Lstdescricao1.ColumnCount = 4
' Lstdescricao1.RowSource = "Plan1!K2:n2" & Registros
'End With
'End If
'End Sub
o botao consultar com este codigo para :
Private Sub BtnConsultar_Click()
Dim Lin As Integer
Lin = 2
Do Until Sheets("Plan1").Cells(2,
.Value = Empty
If Sheets("Plan1").Cells(2,
.Value = Lstdescricao1.Value Then
Txttel2.Value = Sheets("plan1").Cells(Lin,
.Value
Txtcliente1.Value = Sheets("Plan1").Cells(Lin, 1).Value
Txtend1.Value = Sheets("plan1").Cells(Lin, 2).Value
Txtinformacao1.Value = Sheets("plan1").Cells(Lin, 3).Value
Txtuf1.Value = Sheets("Plan1").Cells(Lin, 4).Value
Txtcep1.Value = Sheets("Plan1").Cells(Lin, 5).Value
Txtemail1.Value = Sheets("plan1").Cells(Lin, 6).Value
Txttel1.Value = Sheets("plan1").Cells(Lin, 7).Value
txttipoimovel1.Value = Sheets("plan1").Cells(Lin, 9).Value
Txtend2.Value = Sheets("plan1").Cells(Lin, 10).Value
Txtbairro1.Value = Sheets("plan1").Cells(Lin, 11).Value
txttipo1.Value = Sheets("plan1").Cells(Lin, 12).Value
Txtvalor1.Value = Sheets("plan1").Cells(Lin, 13).Value
Txtcidade1.Value = Sheets("plan1").Cells(Lin, 14).Value
Txtuf2.Value = Sheets("plan1").Cells(Lin, 15).Value
txtpermuta1.Value = Sheets("plan1").Cells(Lin, 16).Value
txtdescricao1.Value = Sheets("plan1").Cells(Lin, 17).Value
End If
Lin = Lin + 1
Loop
End Sub
O que devo estar fazendo de errado?
Me ajudem por favor