Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Highlight Duplicates with different Color

Hello,

I need to highlight batch of duplicates in different color. For example one
set of dups will be red and next set would be yellow and so on.
I have this macro but it highlights every dups with diffrent color.


Sub FindDups()
'
' NOTE: You must select the first cell in the column and
' make sure that the column is sorted before running this macro
'
ScreenUpdating = False
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1, 0).Value
Offsetcount = 1
Do While ActiveCell < ""
If FirstItem = SecondItem Then
ActiveCell.Offset(Offsetcount, 0).Interior.ColorIndex = Int(Rnd(1) *
21) + 2
Offsetcount = Offsetcount + 1
SecondItem = ActiveCell.Offset(Offsetcount, 0).Value
Else
ActiveCell.Offset(Offsetcount, 0).Select
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1, 0).Value
Offsetcount = 1
End If
Loop
ScreenUpdating = True
End Sub


Any help?

Thx.

--
Message posted via http://www.officekb.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Highlight Duplicates, Macro? NPell Excel Worksheet Functions 6 April 9th 08 02:02 PM
Color duplicates saman110 via OfficeKB.com Excel Discussion (Misc queries) 2 October 19th 07 11:26 PM
how do I highlight duplicates cells in excell prior to deletion Paul B[_2_] Excel Worksheet Functions 6 August 21st 07 12:08 PM
How do i locate/highlight duplicates ? Lizardking Excel Discussion (Misc queries) 3 October 12th 06 04:36 PM
compare two columns within a worksheet, then highlight duplicates Beth Excel Worksheet Functions 1 September 20th 06 03:47 PM


All times are GMT +1. The time now is 01:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"