I am trying to remove duplicate value from column U in excel file, while all other columns are empty. Since i am using UsedRange function i am encountering a runtime error. I am using the following code:
Set objXL = CreateObject("Excel.Application")
Set objWB = objXL.Workbooks.Open(basedir & ss)
Set objWS = objWB.Worksheets("Report 2")
objWB.Saved = True
objWB.ActiveSheet.UsedRange.RemoveDuplicates Array(20), 1
objWS.Rows("1:2").Delete
objWS.Columns("A:T").Delete
call objWB.SaveAs(temp_file_bu2,24)
objWB.Saved=True
I tried using Range function also for choosing column and it is not working. If all column under range of UsedRange are filled with duplicate value only the function is working.