Conditional formatting using VB

  • Thread starter Thread starter deelish
  • Start date Start date
D

deelish

I am a very novice programmer...actually to be completely honest, I kno
absolutely nothing about programming VB in Excel. What I would like t
do is write something that will help me do the following:

If cell A2 is greater than 30 and cell B2 says "yes", then have cell B
fill in red.

I would like to do this throughout the spreadsheet until there are n
more entries in either column, and I would like this to occu
automatically (i.e., without having to hit a button).

Thank you so much..
 
As I read your post, you don't need VBA to create the
conditional formatting (CF). Just use Excel's CF feature
and use the "Formula Is" option.

Suggested is the following:
1) First select all the desired cells in Column B.
2) Select Format|Conditional Formatting in the Worksheet
Menu Bar.
3) Select the "Formul Is" option from the drop list.
4) Insert the fomula: =And(A1 > 30, B1 = "Yes")
5) Click the Format button.
6) Select the Patterns tab.
7) Click the red square in the colour palette.
8) Click OK.

Note that when you select multiple cells and apply
conditional formatting to the entire range then the
formatting is applied relative to the first cell in the
selection. In the case above, if Cell B2 says "Yes" and
Cell A2 > 30 then B2 will be coloured red. And if Cell B3
says "Yes" and Cell A3 > 30 then B3 will be coloured red
and so on. As I read your post this is what you wanted.

Regards,
Greg
 
Back
Top