Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Making a cell a certain color for a value

I have a worksheet (Whole sheet) and I want to make a certain value show the
cell as a certain colour i.e. if the cell value is H then I want the cell to
be red, if a cell is L then I want it to be orange etc etc..... (I have
approx 8 differnt cell values and I want a different colour for each)

Can anyone tell me the correct syntax as I can't seem to get it right!!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Making a cell a certain color for a value

Hi,

With a lot of options required I'd use code. Right click your shhet tab,
view code and paste this in. Note the syntax and add other cases as required.
If you don't know the VB colour number then record a macro of yourself
colouring cells to get the numbers.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Select Case UCase(Target.Value)
Case Is = "H"
icolor = 3
Case Is = "F"
icolor = 8
Case Is = "G"
icolor = 10
Case Else
icolor = xlNone
End Select

Target.Interior.ColorIndex = icolor
End Sub


Mike

"NDT_Steve" wrote:

I have a worksheet (Whole sheet) and I want to make a certain value show the
cell as a certain colour i.e. if the cell value is H then I want the cell to
be red, if a cell is L then I want it to be orange etc etc..... (I have
approx 8 differnt cell values and I want a different colour for each)

Can anyone tell me the correct syntax as I can't seem to get it right!!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Making a cell a certain color for a value

Thanks very much Mike
Works a treat!
--
Thanks and Regards
Steve


"Mike H" wrote:

Hi,

With a lot of options required I'd use code. Right click your shhet tab,
view code and paste this in. Note the syntax and add other cases as required.
If you don't know the VB colour number then record a macro of yourself
colouring cells to get the numbers.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Select Case UCase(Target.Value)
Case Is = "H"
icolor = 3
Case Is = "F"
icolor = 8
Case Is = "G"
icolor = 10
Case Else
icolor = xlNone
End Select

Target.Interior.ColorIndex = icolor
End Sub


Mike

"NDT_Steve" wrote:

I have a worksheet (Whole sheet) and I want to make a certain value show the
cell as a certain colour i.e. if the cell value is H then I want the cell to
be red, if a cell is L then I want it to be orange etc etc..... (I have
approx 8 differnt cell values and I want a different colour for each)

Can anyone tell me the correct syntax as I can't seem to get it right!!

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Making a cell a certain color for a value

Glad I could help and thanks for the feedback

"NDT_Steve" wrote:

Thanks very much Mike
Works a treat!
--
Thanks and Regards
Steve


"Mike H" wrote:

Hi,

With a lot of options required I'd use code. Right click your shhet tab,
view code and paste this in. Note the syntax and add other cases as required.
If you don't know the VB colour number then record a macro of yourself
colouring cells to get the numbers.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Select Case UCase(Target.Value)
Case Is = "H"
icolor = 3
Case Is = "F"
icolor = 8
Case Is = "G"
icolor = 10
Case Else
icolor = xlNone
End Select

Target.Interior.ColorIndex = icolor
End Sub


Mike

"NDT_Steve" wrote:

I have a worksheet (Whole sheet) and I want to make a certain value show the
cell as a certain colour i.e. if the cell value is H then I want the cell to
be red, if a cell is L then I want it to be orange etc etc..... (I have
approx 8 differnt cell values and I want a different colour for each)

Can anyone tell me the correct syntax as I can't seem to get it right!!

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
Making a Cell turn color based on results in another cell melaniem Excel Discussion (Misc queries) 6 January 11th 08 05:25 AM
Change font color when making changes Mona Excel Discussion (Misc queries) 5 June 28th 07 08:43 PM
Making special color effects in excel charts paulabrozek Excel Discussion (Misc queries) 5 June 16th 06 09:36 PM
Making Font Color Changes in IF Statements BigEyedFish Excel Worksheet Functions 2 July 21st 05 11:52 PM
How do I keep formats (eg.color) when making a relative reference I hope you can help Excel Discussion (Misc queries) 2 June 22nd 05 03:00 PM


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