PC Review


Reply
Thread Tools Rate Thread

Conditional Formatting of one cell based on another using vba

 
 
Dee
Guest
Posts: n/a
 
      5th Oct 2008
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
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      5th Oct 2008
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

 
Reply With Quote
 
Dee
Guest
Posts: n/a
 
      5th Oct 2008
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional formatting, based on a different cell? GD Microsoft Excel Misc 1 9th Feb 2009 08:14 PM
Conditional formatting Based on cell A text with conditions in Cell B Raicomm Microsoft Excel Misc 0 21st Jan 2008 04:46 PM
conditional Formatting based on cell formatting Totom Microsoft Excel Worksheet Functions 1 20th Jan 2007 02:02 PM
conditional Formatting based on cell formatting Totom Microsoft Excel Worksheet Functions 0 15th Jan 2007 04:35 PM
Conditional cell background formatting, based on cell content nosivad Microsoft Excel Misc 5 11th Feb 2006 11:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:51 PM.