how to update certain text in a cell according to thecell colour

A

Ashish Patil

Hi
How can we write a macro which helps me to update certain text based on the cell colour. Eg. If cell B2 is formatted in "Red" colour then the text should be updated as "NO" and if it is formatted as green in colour then the text must be updated as "YES"? Can the same be done for a range of cells?

Also is there a way by which i can trigger a macro on filling of a cell. Means the moment i enter some text in a specific cell (say B2) a macro should get triggred.
 
R

ryguy7272

I think you've got it backwards, typically you want a "Yes" or "No" response,
and based on this, apply color to a cell. This is called Conditional
Formatting.
Look at this site:
http://www.contextures.com/xlCondFormat01.html


This was from a post a while back:
I have a cell f2 that has a formula, and I want Macro1 to run automatically
when that value is different than 0, or Macro2 to run if that value is = 0.

Private Sub Worksheet_Change(ByVal Target As Range)
if not intersect(target, range("H12:H1000")) is nothing
if range("F2").value = 0 then
Call Macro2
else
Call Macro1
endif
end if
end sub

Jim Thomlinson is quite a guy!!


Regards,
Ryan---
 

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