Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Coloring cells

This is the code I use to color a cell based on text in the cell:

If Not Intersect(Target, Range("A5:G56")) Is Nothing Then

Select Case Left(Target.Text, 4)
Case Is = "Sick"
icolor = 38

End Select

How can I also get it to color the 2 cells immediately above it?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Coloring cells

Target.offset(-2,0).Resize(3,1).Interior.ColorIndex = icolor

--
Regards,
Tom Ogilvy

"Patrick Simonds" wrote in message
...
This is the code I use to color a cell based on text in the cell:

If Not Intersect(Target, Range("A5:G56")) Is Nothing Then

Select Case Left(Target.Text, 4)
Case Is = "Sick"
icolor = 38

End Select

How can I also get it to color the 2 cells immediately above it?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Coloring cells

Your code doesn't color anything...


However, you can try:

Dim iColor As Long
If Not Intersect(Target, Range("A5:G56")) Is Nothing Then
Select Case Left(Target.Text, 4)
Case Is = "Sick"
iColor = 38
Case Else
iColor = xlColorIndexNone
End Select
Target.Offset(-2, 0).Resize(3, 1).Interior.ColorIndex = iColor
End If



In article ,
"Patrick Simonds" wrote:

This is the code I use to color a cell based on text in the cell:

If Not Intersect(Target, Range("A5:G56")) Is Nothing Then

Select Case Left(Target.Text, 4)
Case Is = "Sick"
icolor = 38

End Select

How can I also get it to color the 2 cells immediately above it?

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
Coloring cells OldManEd Excel Discussion (Misc queries) 8 June 4th 10 05:44 AM
coloring cells 6371 New Users to Excel 2 April 22nd 09 04:26 AM
coloring cells egarcia Excel Discussion (Misc queries) 0 November 29th 06 05:49 PM
Coloring Cells Gabbi Excel Worksheet Functions 2 July 27th 05 09:54 PM
coloring cells NiCK Excel Programming 2 August 18th 04 12:48 AM


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