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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Fill Color based on contents of Cell

Status
Not open for further replies.

BTon15

Programmer
Nov 21, 2001
29
0
0
GB
I'm new to VBA in Excel and I'm trying to do something that sounds simple to me, but I can't work out how to do it.

I want to fill the colour of each row in my worksheet based on the contents of one of my columns.

e.g. if column D contains "Paid", I want the row to be coloured green. If column D contains "Not Paid", I want the row to be coloured Red, etc.

My data is loaded via a query to a MySQL database, so I want the colouring to be done dynamically when I load the spreadsheet, and also when I refresh my data.

I'm using Excel 2000.

Thanks in advance for any help.
 
Have a look at Conditional formatting.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
As I said I'm new to Excel - I've had a look at Conditional formatting but can't work out what I need to do.

Any help to get me started with my problem would be greatly appreciated.
 
Using conditional formatting, you'll need to start by formatting one row.

Select the row. (Row 1 for this example)
Format -> Conditional formatting

Condition 1 -> Formula is -> =A4=Paid

(it's A4 because you're on row A and Column 4 (D) is the one you're testing)

Click Format.. and select the formatting you want.

Click Add to add another condition.

Condition 2 -> Formula is -> A4 = "Not Paid"

Click OK

Then select the row and Paste special -> Formatting to all other rows you require.

Enjoy.

Steve
"Health and Knowledge and Wealth and Power
 
Thanks guys, I have this working now using Conditional Formatting as you suggested.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top