Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB editor for 9 conditional formats

Status
Not open for further replies.

kimmbo

Technical User
May 30, 2008
1
US
Dear All

G0 easy - I'm new!

I'm looking for a solution to use a range of conditional formats (9 in total). I can see how this is possible in a whole worksheet using the VB editor, but I want to specify a range. However, I also need to value in one cell to influence to conditional formatting in adjacent cells.

For example:
If A2 = 1 then color A2 and A1 pink
If A2 = 2 then colour A2 and A1 pink

And so on.

I would like to do this regardless of the value in A1. Basically the value in A2 needs to guide the conditional formatting of adjacent cells.

I know how to do this using the simple conditional formatting with just 3 options, but would like 9!

All help very much appreciated in advance.
 





Hi,

Use your macro recorder to determine the colorindex values you want.
Code:
   select case cells(2,"A").value
      case 1
         range([A1],[A2]).interior.colorindex = 22
      case 2
         range([A1],[A2]).interior.colorindex = 22
   end select


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top