Vídeo recomendado
https://youtu.be/diWPPPhW-9E

Excluir duplicados

Fórum para dúvidas sobre os fundamentos da linguagem de programação Visual Basic no contexto do VBA
Wenderson Prates
Acabou de chegar
Acabou de chegar
Mensagens: 1
Registrado em: Qui Jul 17, 2014 10:59 am

Excluir duplicados

Mensagem por Wenderson Prates »

Eu tenho Pla1 e Plan2 ele vai pegar o que tenho na plan1 coluna A e excluir todos os repitidos na Plan2 Coluna A alguém, poderia me ajudar. Exemplo das palnilhas:
Plan1 Plan2
Col.A Col.A
T1-1 T1-1 (Excluir)
T2-2 T1-1 (Excluir)
............ T2-2 (Excluir)
............ T2-2 (Excluir)
............ T3-3
............ T3-3

Se puder me ajudar agradeço a atenção! Estou tentando usar o código abaixo mas não esta dando certo! Obrigado....
Sub DelDups()
Dim iListCount As Integer
Dim iCtr As Integer

Application.ScreenUpdating = False

UltLin = Cells(Rows.Count,"A").End(xlUp).Row
iListCount = Sheets("Sheet2").Range("A2:A" & UltLinha).Rows.Count

For Each x In Sheets("Sheet1").Range("A2:A" & UltLinha)
For iCtr = 1 To iListCount
If x.Value = Sheets("Sheet2").Cells(iCtr, 1).Value Then
Sheets("Sheet2").Cells(iCtr, 1).EntireRow.Delete
iCtr = iCtr + 1
End If
Next iCtr
Next
Application.ScreenUpdating = True
End Sub


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


Avatar do usuário
vbalexandre
Manda bem
Manda bem
Mensagens: 122
Registrado em: Sáb Dez 11, 2010 6:57 pm

Re: Excluir duplicados

Mensagem por vbalexandre »

Boa noite!!

Se eu não estou enganado, eu respondi tal dúvida em:
http://www.planilhando.com.br/forum/index.php

Att


Responder