LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Shading a cell relative to three other cells & repeat

I wish to shade to grey, or change to white, cells in a chart from G8 to BR28
relative to variable information in columns B and D and compared to preset
values in row 7. I don't believe that this code can be within the cell as the
user will be entering text there at some other time. I think this will
probably be updated using the Worksheet_Change event but if anyone has a
better idea, I am open for it.

In pseudo-pseudo code:

For the first row:
If ((B8 <= G7) And (D8 = G7)) Then (G8 through J8).shading = grey (else
shading = white.)
If ((B8 <= K7) And (D8 = K7)) Then (K8 through N8).shading = grey (else
shading = white.)
If ((B8 <= O7) And (D8 = O7)) Then (O8 through R8).shading = grey (else
shading = white.)
If ((B8 <= S7) And (D8 = S7)) Then (S8 through V8).shading = grey (else
shading = white.)
...
This continues to shade horizontally until G8 - BR8 have been shaded or
not

And similar for the second row:
If ((B9 <= G7) And (D9 = G7)) Then (G9 through J9).shading = grey (else
shading = white.)
If ((B9 <= K7) And (D9 = K7)) Then (K9 through N9).shading = grey (else
shading = white.)
If ((B9 <= O7) And (D9 = O7)) Then (O9 through R9).shading = grey (else
shading = white.)
If ((B9 <= S7) And (D9 = S7)) Then (S9 through V9).shading = grey (else
shading = white.)

and this will continue for rows 8 - 28.

If this requires 1280 lines of code with minute changes in each line, then so
be it but I believe that some fancy looping can be done here. I just don't
know the VBE code to loop it.

I hope my comparison logic is correct here (-:

--
Message posted via http://www.officekb.com

 
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
repeat cell values into other cells x times Abi L Excel Discussion (Misc queries) 0 April 17th 07 12:02 PM
How do I count cells with a specific cell shading? Mistermond Excel Worksheet Functions 4 November 13th 06 09:42 PM
Cell shading in linked cells LrngasIgo Excel Worksheet Functions 5 September 11th 06 01:54 PM
Conditional Cell Shading (based on the shading of other cells) Tubby Excel Worksheet Functions 2 June 20th 06 10:03 PM
Apply cell shading based on adjacent cells in EXCEL garywr Excel Worksheet Functions 3 September 10th 05 01:35 PM


All times are GMT +1. The time now is 04:18 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"