Hi everyone,
I have written a code to remove duplicates from a given range, and the problem is, my code works without any problem in my Mac computer (excel 2011), but when I try to run this code on Windows (excel 2010), the remove duplicates method just does not remove the duplicates!!!
The part of the code that doesn't work was:
Please note that there is no problem with the definition of the range.
I know that the removeduplicates method has the two optional parameters 'columns' & 'header', which I omitted at first. I have omitted them because the default options for these paramaters suit my needs. After multiple trials, I have noticed that when I omit the 'columns' parameter in Excel 2010 in Windows, the removeduplicates method does not do anything! It does not even give an error! So then, I tried to accomplish the task by simply inputting the columns and header parameters, like this:
Note that colnumber is a variable, which is defined as an integer, and it is the first column of the range.
When write a simple line of code like this in a new macro, the code works. However, when I run this code in the whole macro I wrote, I have an even more interesting problem, it runs smoothly the first time in the loop, than after that it keeps on generating the error "application defined or object defined error". The code as it is in the loop is below.
Note that the worksheet I am working on is not protected.
Please help me, I have been searching all over the internet for weeks, and I couldn't find anything to this annoying problem!
Gokalp
Bookmarks