Hi,
I am new to this VBA, and i was trying to highlight duplicate values through the vba. Please see below code and correct me; where i shall modify/rectify the code
Please Login or Register to view this content.
Thanks in advance !
Hi,
I am new to this VBA, and i was trying to highlight duplicate values through the vba. Please see below code and correct me; where i shall modify/rectify the code
Please Login or Register to view this content.
Thanks in advance !
Hello BRout,
Your macro will only check if a duplicate appears sequentially in the list, i.e. 1,2,3,3,3,4. There are a few ways to do this. Most involve a double loop to compare each value against all other values. While this works, it is extremely slow as the list gets bigger.
A much better approach is save the unique values in a Collection object. The Collection object will throw an error if an item to be added already exists in the collection. The error is then the signal the data is duplicate. Collection objects use a hash method to access the members randomly. Here is your macro using a Collection object.
Please Login or Register to view this content.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Star below the post.3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
I wrote code for that some time ago. See below. Disclaimer - I wrote it some time ago and no longer use it. No idea how well it works now.
Please Login or Register to view this content.
*******************************************************
HELP WANTED! (Links to Forum threads)
Trying to create reusable code for Custom Events at Workbook (not Application) level
*******************************************************
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks