![]() |
Conditional Formatting of one cell based on another using vba
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. -- DC |
Conditional Formatting of one cell based on another using vba
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 "Dee" wrote: 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. -- DC |
Conditional Formatting of one cell based on another using vba
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. -- DC "Mike H" wrote: 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 "Dee" wrote: 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. -- DC |
All times are GMT +1. The time now is 05:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com