Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default different color for duplicates!!! how?

i have table full of numbers,
what i need is to find duplicates and mark them with different colors.
so like one numbers with red color, others with green, other yellow and so on.
so each set of duplicates will have own color.
i think it will be easier to see if we have this number so i will then
delete it from all rows.
i just used this formula, but donno how to make scenario above
=COUNTIF(L:L;L27)1


thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default different color for duplicates!!! how?

The following loops through a colour list to highlight cells with duplicates.


Sub test()
HighlightDuplicates Range("A2:A201")
End Sub

Sub HighlightDuplicates(DuplicateRange As Range)
Dim rng As Range, rngF As Range, rngFull As Range, rngLast As Range
Dim lngColorIndex As Long, varColors As Variant

Set rngFull = DuplicateRange

varColors = Array(3, 4, 5, 6, 7, 8, 9)
lngColorIndex = LBound(varColors)

rngFull.Interior.ColorIndex = xlColorIndexNone
Set rngLast = rngFull(rngFull.Rows.Count, rngFull.Columns.Count)

For Each rng In rngFull
If rng.Interior.ColorIndex = xlColorIndexNone Then
If Application.WorksheetFunction.CountIf(rngFull, rng.Value) 1 Then
For Each rngF In rngFull
If rngF.Value = rng.Value Then rngF.Interior.ColorIndex = varColors(lngColorIndex)
Next
lngColorIndex = lngColorIndex + 1
If lngColorIndex UBound(varColors) Then lngColorIndex = LBound(varColors)
End If
End If
Next
End Sub


Cheers,
Rob


irealtymods wrote:
i have table full of numbers,
what i need is to find duplicates and mark them with different colors.
so like one numbers with red color, others with green, other yellow and so on.
so each set of duplicates will have own color.
i think it will be easier to see if we have this number so i will then
delete it from all rows.
i just used this formula, but donno how to make scenario above
=COUNTIF(L:L;L27)1


thank you

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Highlighting Sets of Duplicates in Excel

Rob,

Can this script be adjusted to work on the entire A column?

thanks, h



Rob van Gelder wrote:

The following loops through a colour list to highlight cells with duplicates.
08-Dec-09

The following loops through a colour list to highlight cells with duplicates.


Sub test()
HighlightDuplicates Range("A2:A201")
End Sub

Sub HighlightDuplicates(DuplicateRange As Range)
Dim rng As Range, rngF As Range, rngFull As Range, rngLast As Range
Dim lngColorIndex As Long, varColors As Variant

Set rngFull = DuplicateRange

varColors = Array(3, 4, 5, 6, 7, 8, 9)
lngColorIndex = LBound(varColors)

rngFull.Interior.ColorIndex = xlColorIndexNone
Set rngLast = rngFull(rngFull.Rows.Count, rngFull.Columns.Count)

For Each rng In rngFull
If rng.Interior.ColorIndex = xlColorIndexNone Then
If Application.WorksheetFunction.CountIf(rngFull, rng.Value) 1 Then
For Each rngF In rngFull
If rngF.Value = rng.Value Then rngF.Interior.ColorIndex = varColors(lngColorIndex)
Next
lngColorIndex = lngColorIndex + 1
If lngColorIndex UBound(varColors) Then lngColorIndex = LBound(varColors)
End If
End If
Next
End Sub


Cheers,
Rob


irealtymods wrote:

Previous Posts In This Thread:

On Monday, December 07, 2009 7:31 AM
irealtymods wrote:

different color for duplicates!!! how?
i have table full of numbers,
what i need is to find duplicates and mark them with different colors.
so like one numbers with red color, others with green, other yellow and so on.
so each set of duplicates will have own color.
i think it will be easier to see if we have this number so i will then
delete it from all rows.
i just used this formula, but donno how to make scenario above
=COUNTIF(L:L;L27)1


thank you

On Tuesday, December 08, 2009 1:10 AM
Rob van Gelder wrote:

The following loops through a colour list to highlight cells with duplicates.
The following loops through a colour list to highlight cells with duplicates.


Sub test()
HighlightDuplicates Range("A2:A201")
End Sub

Sub HighlightDuplicates(DuplicateRange As Range)
Dim rng As Range, rngF As Range, rngFull As Range, rngLast As Range
Dim lngColorIndex As Long, varColors As Variant

Set rngFull = DuplicateRange

varColors = Array(3, 4, 5, 6, 7, 8, 9)
lngColorIndex = LBound(varColors)

rngFull.Interior.ColorIndex = xlColorIndexNone
Set rngLast = rngFull(rngFull.Rows.Count, rngFull.Columns.Count)

For Each rng In rngFull
If rng.Interior.ColorIndex = xlColorIndexNone Then
If Application.WorksheetFunction.CountIf(rngFull, rng.Value) 1 Then
For Each rngF In rngFull
If rngF.Value = rng.Value Then rngF.Interior.ColorIndex = varColors(lngColorIndex)
Next
lngColorIndex = lngColorIndex + 1
If lngColorIndex UBound(varColors) Then lngColorIndex = LBound(varColors)
End If
End If
Next
End Sub


Cheers,
Rob


irealtymods wrote:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Excel Identifying which formulas are slowing down workbook recalaculation
http://www.eggheadcafe.com/tutorials...aculation.aspx
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Highlighting Sets of Duplicates in Excel

Rob,

Can this script be adjusted to work on the entire A column?

thanks, h



Rob van Gelder wrote:

The following loops through a colour list to highlight cells with duplicates.
08-Dec-09

The following loops through a colour list to highlight cells with duplicates.


Sub test()
HighlightDuplicates Range("A2:A201")
End Sub

Sub HighlightDuplicates(DuplicateRange As Range)
Dim rng As Range, rngF As Range, rngFull As Range, rngLast As Range
Dim lngColorIndex As Long, varColors As Variant

Set rngFull = DuplicateRange

varColors = Array(3, 4, 5, 6, 7, 8, 9)
lngColorIndex = LBound(varColors)

rngFull.Interior.ColorIndex = xlColorIndexNone
Set rngLast = rngFull(rngFull.Rows.Count, rngFull.Columns.Count)

For Each rng In rngFull
If rng.Interior.ColorIndex = xlColorIndexNone Then
If Application.WorksheetFunction.CountIf(rngFull, rng.Value) 1 Then
For Each rngF In rngFull
If rngF.Value = rng.Value Then rngF.Interior.ColorIndex = varColors(lngColorIndex)
Next
lngColorIndex = lngColorIndex + 1
If lngColorIndex UBound(varColors) Then lngColorIndex = LBound(varColors)
End If
End If
Next
End Sub


Cheers,
Rob


irealtymods wrote:

Previous Posts In This Thread:

On Monday, December 07, 2009 7:31 AM
irealtymods wrote:

different color for duplicates!!! how?
i have table full of numbers,
what i need is to find duplicates and mark them with different colors.
so like one numbers with red color, others with green, other yellow and so on.
so each set of duplicates will have own color.
i think it will be easier to see if we have this number so i will then
delete it from all rows.
i just used this formula, but donno how to make scenario above
=COUNTIF(L:L;L27)1


thank you

On Tuesday, December 08, 2009 1:10 AM
Rob van Gelder wrote:

The following loops through a colour list to highlight cells with duplicates.
The following loops through a colour list to highlight cells with duplicates.


Sub test()
HighlightDuplicates Range("A2:A201")
End Sub

Sub HighlightDuplicates(DuplicateRange As Range)
Dim rng As Range, rngF As Range, rngFull As Range, rngLast As Range
Dim lngColorIndex As Long, varColors As Variant

Set rngFull = DuplicateRange

varColors = Array(3, 4, 5, 6, 7, 8, 9)
lngColorIndex = LBound(varColors)

rngFull.Interior.ColorIndex = xlColorIndexNone
Set rngLast = rngFull(rngFull.Rows.Count, rngFull.Columns.Count)

For Each rng In rngFull
If rng.Interior.ColorIndex = xlColorIndexNone Then
If Application.WorksheetFunction.CountIf(rngFull, rng.Value) 1 Then
For Each rngF In rngFull
If rngF.Value = rng.Value Then rngF.Interior.ColorIndex = varColors(lngColorIndex)
Next
lngColorIndex = lngColorIndex + 1
If lngColorIndex UBound(varColors) Then lngColorIndex = LBound(varColors)
End If
End If
Next
End Sub


Cheers,
Rob


irealtymods wrote:

On Friday, July 30, 2010 3:20 PM
Mike Hendrickson wrote:

Highlighting Sets of Duplicates in Excel
Rob,

Can this script be adjusted to work on the entire A column?

thanks, h


Submitted via EggHeadCafe - Software Developer Portal of Choice
Custom Favorites Web Site with MongoDb and NoRM
http://www.eggheadcafe.com/tutorials...-and-norm.aspx
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 with different Color samangh1 via OfficeKB.com Excel Discussion (Misc queries) 0 January 22nd 09 08:28 PM
Color duplicates saman110 via OfficeKB.com Excel Discussion (Misc queries) 2 October 19th 07 11:26 PM
Need to Color Record in Duplicates nirod Excel Worksheet Functions 0 October 24th 06 02:15 PM
Color Code Duplicates Lynn[_5_] Excel Programming 2 July 12th 04 09:58 PM
Can MS EXCEL remove duplicates and separate by color coded items ? nilu kazi Excel Programming 1 July 12th 03 10:35 AM


All times are GMT +1. The time now is 05:06 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"