Tenho uma planilha que possuí um CommandButton ao ser clicado ele faz a busca e traz todos os arquivos a conta pesquisada.
Estava funcionando perfeitamente e agora ao clicar no botão simplesmente não acontece nada, nem mesmo uma mensagem de erro.
Alguém poderia me ajudar, por favor?
Private Sub cmdBuscar_Click()
Dim c As Range
Dim li As ListItem
Dim sSearch As String
If txtLocalizar = Empty And txtLocalizarByDate = Empty Then Exit Sub
If txtLocalizarByDate <> Empty Then
sSearch = txtLocalizarByDate.Text
ElseIf txtLocalizar <> Empty Then ' Se existir data, sobrepõe o ID
sSearch = txtLocalizar.Text
End If
lst_busca.ListItems.Clear
For Each c In Range("CUSTOMERS_Account") '("CUSTOMERS_Account")Nome definido criamos o nome para a coluna do "CUSTOMERS_Account"
If c.Text = sSearch Or c.Offset(, 11).Text = sSearch Then
Set li = lst_busca.ListItems.Add(Text:=c.Offset(, -1).Value) ' ID
li.ListSubItems.Add Text:=c.Value ' Account
li.ListSubItems.Add Text:=c.Offset(, 1).Value ' Name
li.ListSubItems.Add Text:=c.Offset(, 2).Value ' Address
li.ListSubItems.Add Text:=c.Offset(, 3).Value ' City
li.ListSubItems.Add Text:=c.Offset(, 4).Value ' Phone
li.ListSubItems.Add Text:=c.Offset(, 5).Value ' Mail
li.ListSubItems.Add Text:=c.Offset(, 6).Value ' E Name
li.ListSubItems.Add Text:=c.Offset(, 7).Value ' E Address
li.ListSubItems.Add Text:=c.Offset(, 8).Value ' E City
li.ListSubItems.Add Text:=c.Offset(, 9).Value ' E Phone
li.ListSubItems.Add Text:=c.Offset(, 10).Value ' E Mail
li.ListSubItems.Add Text:=c.Offset(, 11).Value ' S Date
li.ListSubItems.Add Text:=c.Offset(, 12).Value ' E Date
li.ListSubItems.Add Text:=c.Offset(, 13).Value
' Service
li.ListSubItems.Add Text:=c.Offset(, 14).Value ' Qty
li.ListSubItems.Add Text:=c.Offset(, 15).Value ' Price
li.ListSubItems.Add Text:=c.Offset(, 16).Value ' Amount
li.ListSubItems.Add Text:=c.Offset(, 17).Value ' Due Date
li.ListSubItems.Add Text:=c.Offset(, 18).Value ' Date Paid
li.ListSubItems.Add Text:=c.Offset(, 19).Value ' Overdue
li.ListSubItems.Add Text:=c.Offset(, 20).Value ' Numero de Dias para o Pagamento
End If
Next c
End Sub