Excel 2007-macro programming logic for data validation

D

Derek Megyesi

Greetings,

I am new to this newsgroup, so nice to meet everyone!

I have an Excel dilemma that I’d like help with.

I’d like to apply some macro programming logic to a data validation cell
entry, so then when a certain data value is selected in the pull down, the
entire row changes color. Here is the algorithm I wish to follow:
1) Launch Excel 2007
2) Go to Data -> Data Validation Button -> Data Validation in pulldown
selection
3) On the Data Validation Window, select the following:
a. Allow: List (‘ignore blank’ and ‘in-cell dropdown’ are selected/checked)
b. Source: Pass,Fail,Inactive

4) Now here is the fun part…what I want to do is add macro programming
logic, so that the following occurs:
a. If Data Validation.Pass is selected, change the font color of all text in
the current row to “greenâ€
b. If Data Validation.Fail is selected, change the font color of all text in
the current row to “redâ€
c. If Data Validation.Inactive is selected, change the font color of all
text in the current row to “greyâ€

If someone could help me figure this out, I’d be MOST grateful. My email is
(derekmegac)(at)(hotmail)(dot)(com)
 
D

Don Guillett

easy to do with a worksheet_change event, using select case, tied to your
validation cell.
 
T

Tom Hutchins

You can do this without programming by using conditional formatting. If, for
example, A8 contains your data validation dropdown cell:
- select row 8
- select Home >> Conditional Formatting >> New Rule >> Use a formula to
determine which cells to format
- in the text box under the heading "Format value where this formula is
true", enter
=($A$8="Pass")
- click the Format button. On the Font tab, select your shade of green
- click OK >> OK

Repeat the steps above to add conditional formatting rules when A8 is Fail
or Inactive.

Hope this helps,

Hutch
 

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