#1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating excel file, adding code to it from code, VBE window stays BlueWolverine Excel Programming 0 November 5th 09 07:55 PM
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? [email protected] Excel Programming 4 May 29th 09 10:13 PM
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does ker_01 Excel Programming 6 October 3rd 08 09:45 PM
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. Corey Excel Programming 3 December 11th 06 05:14 AM
Excel code convert to Access code - Concat & eliminate duplicates italia Excel Programming 1 September 12th 06 12:14 AM


All times are GMT +1. The time now is 10:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"