I have this code that I used back then for the removal of duplicates in all sheets. When I used it on my current workbook, it suddenly returned with a run-time error '1004' pointing to the range that I defined. What I want to do is to remove all duplicates based off their value in column F. Can somebody please help me revise the code? Also, would it be possible to revise it so that will ignore specific named sheets? Thanks!
VBA Code:
Sub RemoveDuplicates()
' RemoveDuplicates Macro
' Selects all values then removes duplicates
'
' Declare Current as a worksheet object variable.
Dim Current As Worksheet
Dim starting_ws As Worksheet
Set starting_ws = ActiveSheet 'remember which worksheet is active in the beginning
' Loop through all of the worksheets in the active workbook.
For Each Current In Worksheets
Current.Activate
ActiveSheet.Range("$A$1:$Q$1000").RemoveDuplicates Columns:=6, Header:=xlYes
Next
starting_ws.Activate 'activate the worksheet that was originally active
End Sub