Highlighting duplicate values in Excel in different colors- more colors

https://www.experts-exchange.com/questions/28358221/Highlighting-duplicate-values-in-Excel-in-different-colors.html

This is what I'm trying to do however I get an error message when I run the macro- "subscript out of range" and it stops highlighting at a particular row. I wonder if it's because it ran out of colors?
Keith HunterAsked:
Who is Participating?
 
Subodh Tiwari (Neeraj)Connect With a Mentor Excel & VBA ExpertCommented:
The ColorIndex is allowed between 1 to 56.
All you need is to reset the clr variable back to 3 if it exceeds the 56.
clr = clr + 1
If clr > 56 Then clr = 3

Open in new window

0
 
Keith HunterAuthor Commented:
Great! Thank you for the help. This worked!
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome Keith!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.