alxnc2008
16-01-2019 18:31:54
Olá Pessoal, espero que todos estejam bem, enrosquei para excluir itens da planilha pelo listbox, nesse metodo que estou usando ele apenas usa uma coluna para critério de comparação, no meu caso tá pegando a coluna 0 da list e a G da planilha, mas vou ter nomes repetidos as vezes, precisaria ter pelo menos 3 colunas de critério, segue o comando.
Dim Resp As Integer
Resp = MsgBox("Confirma Exclusão?", vbYesNo, "Excluir")
If Resp = vbYes Then
Planilha5.Select
Planilha5.Range("G1").Select
For i = 0 To (ListBox1.ListCount - 1)
If ListBox1.Selected(i) = True Then
Cod = ListBox1.List(i, 0)
With Worksheets("BASE1").Range("G:M")
Set C = .Find(Cod, LookIn:=xlValues, Lookat:=xlWhole)
If Not C Is Nothing Then
C.Select
Selection.EntireRow.Delete
ListBox1.Selected(i) = False
End If
End With
End If
Next
End If
Tentei mudar na linha "Cod=ListBox1.List(i, 0) " tentei acrescentar ([i, 0],[i,1])
não deu certo, alguma ideia ai pessoal?
Obrigado!
Dim Resp As Integer
Resp = MsgBox("Confirma Exclusão?", vbYesNo, "Excluir")
If Resp = vbYes Then
Planilha5.Select
Planilha5.Range("G1").Select
For i = 0 To (ListBox1.ListCount - 1)
If ListBox1.Selected(i) = True Then
Cod = ListBox1.List(i, 0)
With Worksheets("BASE1").Range("G:M")
Set C = .Find(Cod, LookIn:=xlValues, Lookat:=xlWhole)
If Not C Is Nothing Then
C.Select
Selection.EntireRow.Delete
ListBox1.Selected(i) = False
End If
End With
End If
Next
End If
Tentei mudar na linha "Cod=ListBox1.List(i, 0) " tentei acrescentar ([i, 0],[i,1])
não deu certo, alguma ideia ai pessoal?
Obrigado!