ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   conditional macros (https://www.excelbanter.com/excel-programming/279133-conditional-macros.html)

Crystal[_2_]

conditional macros
 
I have a worksheet that I need to run a macro on where, if certain
cells are blank, then I want to color them yellow. They all start out
pink (required input). I want to then run the macro again and if any
of the yellow cells has then had input put in, then it needs to be
changed back to pink, and any pink cells that no longer have data in
them, need to be turned to yellow.

Any clues?

Crystal

Don Guillett[_4_]

conditional macros
 
Use conditional formatting to make it automatic
formatconditional formatgo from there

"Crystal" wrote in message
m...
I have a worksheet that I need to run a macro on where, if certain
cells are blank, then I want to color them yellow. They all start out
pink (required input). I want to then run the macro again and if any
of the yellow cells has then had input put in, then it needs to be
changed back to pink, and any pink cells that no longer have data in
them, need to be turned to yellow.

Any clues?

Crystal




Crystal Owings

conditional macros
 
Unfortunately, there are more than 3 conditions, and it needs to be a
macro. We've now, also, run into the problem of validation within that
macro, and also validating numbers from other worksheets.

I'm just looking for some snippits of code, so that I can work from
there

Crystal Owings


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Don Guillett[_4_]

conditional macros
 
Sub chgcolor()

For Each c In [a1:c6]
If Len(c) 0 Then c.Interior.ColorIndex = 6
If Len(c) = 0 Then c.Interior.ColorIndex = 7
Next
End SubOK. Will this help?

"Crystal" wrote in message
m...
I have a worksheet that I need to run a macro on where, if certain
cells are blank, then I want to color them yellow. They all start out
pink (required input). I want to then run the macro again and if any
of the yellow cells has then had input put in, then it needs to be
changed back to pink, and any pink cells that no longer have data in
them, need to be turned to yellow.

Any clues?

Crystal




[email protected]

conditional macros
 
David McRitchie shows how to have more than three conditions.

http://www.mvps.org/dmcritchie/excel/event.htm#case

If you're unfamiliar with using code,

http://www.mvps.org/dmcritchie/excel/getstarted.htm

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------On
Unfortunately, there are more than 3 conditions, and it needs to be a
macro. We've now, also, run into the problem of validation within that
macro, and also validating numbers from other worksheets.

I'm just looking for some snippits of code, so that I can work from
there

Crystal Owings




All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com