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: 11
Default Cell and font color

I use code like the short example below as worksheet event code to
change cell and font color in various work sheets. It works perfect
with numeric cell values but now I need to modify it to work with
"cel.value = A" (there will be A thru F) instead of 1.
This will apply to a different range of cells than the numeric, as
maybe B1:B10.
I assume the term "IsNumeric(cel.Value)" needs to be changed, but I
can't figure out what it should be.
Using Office 2000
Can anyone please help?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
For Each cel In Range("A1:A10").Cells
If IsNumeric(cel.Value) And cel.Value < "" Then
If cel.Value = 1 Then
cel.Font.ColorIndex = 1
cel.Interior.ColorIndex = 4
ElseIf cel.Value = 2 Then
cel.Font.ColorIndex = 1
cel.Interior.ColorIndex = 45
End If
Else
cel.Font.ColorIndex = 1
cel.Interior.ColorIndex = 0
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
Copy cell and the font color Falcon248 Excel Discussion (Misc queries) 4 January 22nd 10 07:36 PM
Conditional Format for font color using font color Jim Excel Worksheet Functions 2 August 29th 09 11:54 AM
Cannot change font color or cell color Bezell Excel Discussion (Misc queries) 2 January 30th 09 06:12 PM
How to change the default Border, Font Color, and Cell Color Elijah Excel Discussion (Misc queries) 3 November 2nd 05 11:52 PM
Default Border, Font Color, and Cell Background Color Elijah Excel Discussion (Misc queries) 1 October 28th 05 04:10 PM


All times are GMT +1. The time now is 06:51 AM.

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

About Us

"It's about Microsoft Excel"