Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to check if one of the conditions returns "true"?
I use conditional formatting to highlight cells with wrong data. I want to
write a macro to check if any conditions are met. However even if the cell has green highlight the macro still "sees" it as white i.e. the color of the cell if conditional formatting conditions are false. For example if the "usual" color of the cell is white (2) and in case I enter number "1" it becomes green (35) even if I can see that it is green, macro does not. If I try to use the following line in macro: If Activecell.Interior.ColorIndex=35 then goto green else goto white I will be directed to white: not green: So, if anyone knows how to check that the conditions have been met please, PLEASE teach me, I need your help very much. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to check if one of the conditions returns "true"?
Plagiarize the logic used in the conditional format. Just make VBA use the
same test(s) as the conditional formatting equations. -- Gary's Student "Isito" wrote: I use conditional formatting to highlight cells with wrong data. I want to write a macro to check if any conditions are met. However even if the cell has green highlight the macro still "sees" it as white i.e. the color of the cell if conditional formatting conditions are false. For example if the "usual" color of the cell is white (2) and in case I enter number "1" it becomes green (35) even if I can see that it is green, macro does not. If I try to use the following line in macro: If Activecell.Interior.ColorIndex=35 then goto green else goto white I will be directed to white: not green: So, if anyone knows how to check that the conditions have been met please, PLEASE teach me, I need your help very much. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to check if one of the conditions returns "true"?
I use the formatting in many cells and check many many different conditions.
I would check conditions instead of checking if any of them have been met. Unfortunately my macro would be probably 20 pages long if I use this approach. Thank you anyways :) "Gary''s Student" wrote: Plagiarize the logic used in the conditional format. Just make VBA use the same test(s) as the conditional formatting equations. -- Gary's Student "Isito" wrote: I use conditional formatting to highlight cells with wrong data. I want to write a macro to check if any conditions are met. However even if the cell has green highlight the macro still "sees" it as white i.e. the color of the cell if conditional formatting conditions are false. For example if the "usual" color of the cell is white (2) and in case I enter number "1" it becomes green (35) even if I can see that it is green, macro does not. If I try to use the following line in macro: If Activecell.Interior.ColorIndex=35 then goto green else goto white I will be directed to white: not green: So, if anyone knows how to check that the conditions have been met please, PLEASE teach me, I need your help very much. Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to check if one of the conditions returns "true"?
Chip Pearson has some notes on how to get that stuff.
http://cpearson.com/excel/CFColors.htm But it's not for the faint of heart. I think I'd just mimic the checks in code and check the results there. Isito wrote: I use conditional formatting to highlight cells with wrong data. I want to write a macro to check if any conditions are met. However even if the cell has green highlight the macro still "sees" it as white i.e. the color of the cell if conditional formatting conditions are false. For example if the "usual" color of the cell is white (2) and in case I enter number "1" it becomes green (35) even if I can see that it is green, macro does not. If I try to use the following line in macro: If Activecell.Interior.ColorIndex=35 then goto green else goto white I will be directed to white: not green: So, if anyone knows how to check that the conditions have been met please, PLEASE teach me, I need your help very much. Thanks -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to check if one of the conditions returns "true"?
Thank you very much for the link. I am not sure if I am smart enough to do it
though. I did not read the whole thing but I use "formula is" not "value is" and I use both relative and absolute addresses and it might not be doable anyways. Now I know that I cannot check it quickly though :( too bad :( but thanks for saving me time. :) As for your suggestion... I was thinking about it (and another user already offered it to me too) but I check too many conditions and when I think about finding all the cells with conditional formatting and copying the conditions and using loops, etc... The thing is that I only wanted to worn a user there was a wrong data so I am not sure if it is worth it. I could just remind them that if there is any highlighted cell they need to change it, but they see the colored cells anyways. If it was easy to check I would only display the message to those who did not enter everything correctly. oh well... I will still think about it Thank you very much for your help... "Dave Peterson" wrote: Chip Pearson has some notes on how to get that stuff. http://cpearson.com/excel/CFColors.htm But it's not for the faint of heart. I think I'd just mimic the checks in code and check the results there. Isito wrote: I use conditional formatting to highlight cells with wrong data. I want to write a macro to check if any conditions are met. However even if the cell has green highlight the macro still "sees" it as white i.e. the color of the cell if conditional formatting conditions are false. For example if the "usual" color of the cell is white (2) and in case I enter number "1" it becomes green (35) even if I can see that it is green, macro does not. If I try to use the following line in macro: If Activecell.Interior.ColorIndex=35 then goto green else goto white I will be directed to white: not green: So, if anyone knows how to check that the conditions have been met please, PLEASE teach me, I need your help very much. Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
=IF(test,true,false) only ever returns "true"? | Excel Worksheet Functions | |||
How to count multiple conditions that are "TRUE" | Excel Discussion (Misc queries) | |||
Check if cells contain the word "Thailand", return "TRUE" | Excel Worksheet Functions | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |