![]() |
how to update certain text in a cell according to thecell colour
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. |
how to update certain text in a cell according to the cell colour
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--- -- RyGuy "Ashish Patil" wrote: 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. |
All times are GMT +1. The time now is 05:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com