Conditional Formatting of one cell based on another using vba

D

Dee

Hello, I have a worksheet whos data comes from SQL Server db. Autofilter is
turned on. Within the worksheet are many columns. I would like to make
change the backcolor of the cells in column C based on the content of the
cell in column D on the same row (i.e. c1=5 d1='Pass' change backcolor of c1
to Green). There isn't a range of cells because the db gets updated more rows
are added. How do I code this using vba? I would like to enter this in the
sheet activate event.
 
M

Mike H

Hi,

select C1 then

format|Conditional format
Formula is
enter the formula
=AND(C1=5,D1="Pass")

Pick your colour
OK

use format painter to paint this into additional cells if required.

Mike
 
D

Dee

Mike, thanks for replying. I need to do this with vba code in a module. When
someone opens the workbook i would like for the cells in column C to be color
coded based on column D. There could be 50 rows of data on worksheet one
month, after db is updated there could be 70 rows of data. I want the code
to take care of the formatting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top