Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code help
Hello
I need a code for Range("C4").value. This must be equal to: 1. When font colour in B3 and E3 is black, value= HORSE 2. When font colour in B3 or E3 is blue, value = Range B3 or E3. I don't know if it is possible, any help? Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code help
Your specification is not very clear. I assume Condition #2 means if B3 is
blue, then assign B3's value to C3 or if E3 is blue, then assign E3's value to C3; but what if both C3 and E3 are blue... what assignment should be made then? Also, what if one of either B3 E3 are blue and the other is black... what assignment should be made in that case? Finally, what did you want assigned to C4 if none of those conditions are met? -- Rick (MVP - Excel) "MAX" wrote in message ... Hello I need a code for Range("C4").value. This must be equal to: 1. When font colour in B3 and E3 is black, value= HORSE 2. When font colour in B3 or E3 is blue, value = Range B3 or E3. I don't know if it is possible, any help? Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code help
Trying to do things based on color is really a generally bad idea. How are
the font colors in B3/E3 getting set to Black or Blue? If you're using conditional formatting for them to change color, then use the same rule you used for conditional formatting to set the value of C4. And what do we do if both B3 and E3 have blue font? Which value to choose then? But if you really want code to get the job done, it's probably going to be Worksheet_Change() or Worksheet_Activate() event code, and we need a complete set of rules to create the code from. So far we have B3 AND E3 are black font, C4="HORSE" but actually beyond that, no set rules: B3 AND E3 are blue -- do what with C4 B3 is blue, E3 is black -- do what with C4 (set = B3 I think?) B3 is black, E3 is blue -- do what with C4 (set =E3 I think?) By the way, if B3 and E3 font color is being set to Blue (or black) via conditional formatting, it becomes very difficult to test the font color as it will show as the basic non-conditional formatted color, so we would need to know the rules applied to B3 and E3 for the conditional formatting to write the code -- which leads us back to simply applying the same rules to C4 without using any code at all. "MAX" wrote: Hello I need a code for Range("C4").value. This must be equal to: 1. When font colour in B3 and E3 is black, value= HORSE 2. When font colour in B3 or E3 is blue, value = Range B3 or E3. I don't know if it is possible, any help? Thanks in advance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code help
Hello Rick
I used conditional formatting for these to change colours. If I have C3 = D3, B3 and E3 remain black. IF I have C3 D3 the font colour in B3 becomes blue and E3 becomes red and vice versa. So when B3 is black, E3 is always black and vice versa. When B3 is blue, E3 becomes red and vice versa. Is this helps you? Thanks a lot. "Rick Rothstein" wrote: Your specification is not very clear. I assume Condition #2 means if B3 is blue, then assign B3's value to C3 or if E3 is blue, then assign E3's value to C3; but what if both C3 and E3 are blue... what assignment should be made then? Also, what if one of either B3 E3 are blue and the other is black... what assignment should be made in that case? Finally, what did you want assigned to C4 if none of those conditions are met? -- Rick (MVP - Excel) "MAX" wrote in message ... Hello I need a code for Range("C4").value. This must be equal to: 1. When font colour in B3 and E3 is black, value= HORSE 2. When font colour in B3 or E3 is blue, value = Range B3 or E3. I don't know if it is possible, any help? Thanks in advance. . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code help
I believe I have it now, in cell C4
=IF(C3=D3,"Horse",IF(C3D3,B3,E3)) "MAX" wrote: Hello Rick I used conditional formatting for these to change colours. If I have C3 = D3, B3 and E3 remain black. IF I have C3 D3 the font colour in B3 becomes blue and E3 becomes red and vice versa. So when B3 is black, E3 is always black and vice versa. When B3 is blue, E3 becomes red and vice versa. Is this helps you? Thanks a lot. "Rick Rothstein" wrote: Your specification is not very clear. I assume Condition #2 means if B3 is blue, then assign B3's value to C3 or if E3 is blue, then assign E3's value to C3; but what if both C3 and E3 are blue... what assignment should be made then? Also, what if one of either B3 E3 are blue and the other is black... what assignment should be made in that case? Finally, what did you want assigned to C4 if none of those conditions are met? -- Rick (MVP - Excel) "MAX" wrote in message ... Hello I need a code for Range("C4").value. This must be equal to: 1. When font colour in B3 and E3 is black, value= HORSE 2. When font colour in B3 or E3 is blue, value = Range B3 or E3. I don't know if it is possible, any help? Thanks in advance. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating excel file, adding code to it from code, VBE window stays | Excel Programming | |||
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? | Excel Programming | |||
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does | Excel Programming | |||
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. | Excel Programming | |||
Excel code convert to Access code - Concat & eliminate duplicates | Excel Programming |