Can Excel's field fill colors be changed using "IF" statements?

J

JHG

I'm trying to use "IF" staements in Excel to pull values into fields as well
as to change the field fill color based on certain parameters. Pulling the
values in is the easy part, but can the field fill colors be controlled as
well?
 
G

Gary Brown

What do you mean by 'fields'?
If you're talking about cells.
myrange.Interior.ColorIndex = 6 'yellow
myrange.Interior.ColorIndex = 3 'red
myrange.Interior.ColorIndex = 5 'blue
If you're talking about listboxes, textboxes, comboboxes...
Me.ListBox1.BackColor = "&H0000FFFF&" 'yellow
Me.ListBox1.BackColor = "&H000000FF&" 'red
Me.ListBox1.BackColor = "&H00FF0000&" 'blue
 
J

JHG

Hi Gary - yes, I was talking about cells. I appreciate the response but I'm
still not sure howto use what you have given me. I've tried to test by
plugging a statement into a cell but receive errors.I also tried an"=" but it
didn't like that either.

Thanks,

Jeff
 

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