Any ideas for conditional formatting?

Joined
Jul 28, 2009
Messages
1
Reaction score
0
Using Excel 2003. Want to be able to highlight erroneous data. Ie. data in column b, column c to read '1' for erroneous data, or '0' if all ok. '1' in column c should highlight data in column b (or entire row) in colour. Any ideas?
 
Joined
Aug 3, 2009
Messages
2
Reaction score
0
I am answering this without knowing your programming level or skills. Please don't take offense if I am talking down to you. If so, someone else may find it useful later.
You can use the Worksheet.SelectionChange to highlight the row or cell. Actually you can click on column b for OK and Column c for not ok or some such thing. The problem is, the machine won't know what is wrong or right, only you. So you have to tell the machine "This is wrong" or "This is right." You can do that by either presenting a message box asking or clciking on the right thing for each condition. The SelectionChange routine is called and Target is passed. Target is a range that has all the details for the range built in so you can get the Target.Row, Target.Column, Traget.Cells(Target.row, target.column) and such. Using that it is no problem to select the row on which target was passed and change the fill.
Open the developer tab of excel and click on Record Macro. It asks you what to call the macro. Answer any way you can remember the name or just take the default.
Clikc on a row so the whole row is highlighted.
Change the fill with the color you want for good, bad or indifferent.
Stop the recording.
Go to the visual basic editor
Open the folder called Module
Your macro recding code will be located there with the name you gave it.
Now you've got the code you can use in your SelectionChange sub.

Be carefull. Every time you click or change cells this routine is going to run. Make sure you wrap any code you write with some sort of test!
 

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