Hi,
I'm using the below code to remove duplicates. It reads the values in column N and if a duplicate is found, it deletes the values in columns A to G for the row in which the duplicate is found.
The issue is that it's working correctly up until a point where is throws the 1004 error - "Unable to get the CountIf property of the WorksheetFunction class"![]()
Sub DeleteDupes() Dim x As Long Dim LastRow As Long Sheets("Extract").Select LastRow = Range("A65536").End(xlUp).Row For x = LastRow To 1 Step -1 If Application.WorksheetFunction.CountIf(Range("N1:N" & x), Range("N" & x).Text) > 1 Then Range("A" & x & ":G" & x).Select Selection.ClearContents End If Next x End Sub
Any ideas what is causing this? Am I better off using another method?
Thanks!
Bookmarks