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: 18
Default Applying background color to cells

With the help of Mr. de Bruin and Mr. Dibben, I have successfully applied a color code to an aray of cells using the suggested code. The cells in seven columns have been colored based on their text value. Now I am trying to apply the same colors to the cells in an adjacent column regardless of their content. For instance, cell B8 is assigned a color based on its content and I want to apply the same color to E8 even though E8 may be empty. Then B9 and E9 etc. Any suggestions would be appreciated. I am currently using the following code
Private Sub Worksheet_Change(ByVal Target As Range
Dim Num As Lon
Dim rng As Rang
Dim vRngInput As Varian
Set vRngInput = Intersect(Target, Range("B8:B19,F8:F19,J8:J19,N8:N19,R8:R19,V8:V19,Z 8:Z19")
If vRngInput Is Nothing Then Exit Su
For Each rng In vRngInpu
'Determine the colo
Select Case rng.Valu
Case Is = "SSH": Num = 3
Case Is = "SMH": Num = 3
Case Is = "SSO": Num = 2
Case Is = "SKMH": Num = 3
Case Is = "SA": Num = 4
Case Is = "SBC": Num = 4
Case Is = "HC": Num = 3
Case Is = "ADMIN": Num = 5
Case Is = "OC": Num = 1
End Selec
'Apply the colo
rng.Interior.ColorIndex = Nu
Next rn
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
How to add cells with a particular background color? BruceN1 Excel Discussion (Misc queries) 4 February 29th 08 10:05 PM
change background color in cells Joe Excel Worksheet Functions 4 November 6th 07 11:20 PM
Applying conditional formating to make cells change color [email protected] Excel Discussion (Misc queries) 1 March 6th 07 10:51 PM
Color background with Matching cells in row Diggsy Excel Worksheet Functions 6 January 31st 06 08:58 PM
Applying background color to cells Erik[_6_] Excel Programming 0 February 26th 04 03:41 AM


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