LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Repeating Values

I thought that the following code will help me identify repeating values and
turn the font in that cell white. I found something that shows how to hide
repeating values through conditional formatting -- however, that is not
helpful to me as there is the possibility that alternate rows may be shaded
gray and it doesn't seem easy to change the font when conditional formatting
is in play.

Anyway, here is the code that I have. The if statement comes out as an
error. Can someone please help me correct my mistake? Thank you.

Sub mcrRepeatValuesFont()
'2=White; 15=Gray
'If value repeats change font of lower cell to white
Dim DataRng As Range
Dim CellRng As Range

Set DataRng = Range("k1:k1000")
For Each CellRng In DataRng
If CellRng.Offset(-1, 0).Value = CellRng.Value Then
CellRng.Font.ColorIndex = 2
End If
Next
End Sub
 
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
repeating values Peach Excel Worksheet Functions 1 November 29th 09 02:45 AM
Counting repeating cell values Matt G[_2_] Excel Worksheet Functions 2 October 10th 08 08:58 PM
repeating values [email protected] Excel Worksheet Functions 2 June 12th 08 04:55 PM
can i stop repeating values? Haitham Excel Discussion (Misc queries) 2 August 3rd 06 09:01 AM
excluding repeating values neda5 Excel Discussion (Misc queries) 2 July 10th 05 11:59 PM


All times are GMT +1. The time now is 04:40 AM.

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"