Well this is not the first time im asking these question here but I cannot make it over. I have to delete the duplicate rows in a column. say from
range("A1:A30000") have to delete all the duplicate rows in these columns
I have used the previous solutions from my previous questions given by the programmers on the stackoverflow. They are working amazing but not these time.Last time I had each row of 15 columns but these time each row with 40 columns and none of the scripts working. The pc its just getting hang and sometimes taking 2 hrs thats not what i want. I have used the dictionary method as suggested by Issun,Jon,Reafidy and Doc brown even they are not working. I dont know why.
So I thought to use the advanced filters but im unable to delete the duplicate rows from vba. I dont find it on google, I see the manual one with the boxes but not the vba script even i find its not working fine.
Range("A1:A5").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
What I have to do after applying that line. delete the duplicate rows now. I remember its like copy开发者_StackOverflow pasting but i dont remember the code well and something like
xltypeinvisble:delete
I dont remember the code well . I remember that i read on google now im unable to find it.
can anyone tell me to delete the duplicate entries using the advanced filter method ? do you think ,that rows had 40 columns each and that made my scripts to take long time and sometimes hang up?what might be the cause to it?
any other method which is faster is appreciated (probably dictionary one). I belive people say dictionary method but i dont know its not working fine may be the code error or not sure about the reason.its just getting hang up. so unable to know why, well its working fine for small data that i tested. but not with the bigger one.
any help is greatly appreciated!
I'm not familiar with the single line command you are looking for to delete all invisible rows at once, but you can loop through the rows in the range and manually delete them.
If this still runs too slow for you, you may want to consider adding the VBA commands to turn off screen updating and re-calculations while the macro is running.
Sub DeleteDUpes()
Dim ThisRange As Range
Dim NewRange As Range
Set ThisRange = Range("A1:A30000")
ThisRange.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
' Loop through each row from bottom up, deleting rows hidden by filter
For thisrow = ThisRange.Rows.Count To 1 Step -1
Set NewRange = ThisRange.Resize(1).Offset(thisrow - 1, 0)
If NewRange.EntireRow.Hidden Then
r.EntireRow.Delete
End If
Next
End Sub
精彩评论