View Single Post
 
Old 06-13-2014, 07:35 AM
EC37 EC37 is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: May 2014
Location: Waltham, MA
Posts: 56
EC37 is on a distinguished road
Default

OK, so, lots to take in and I appreciate your help..

I feel stupid by asking what you mean by 'static' when referring to the ranges. The ranges do look a bit odd, but that is because first, I filtered the rows to only show me the rows identified as "Header". However, we can't simply color based on that information- because Header not only identifies the Phases, but sub-phases as well. It is something I can certainly change, now that i Think of it- to make the code a bit easier to write. We could simply color cells based on the words "Phase" and "Sub-Phase" in column L. Phase is one color, sub-phase is another.

Without getting too far off topic from your response- I will try to de-code in my own dumbed down version of what I'm looking at .
First delete the identified columns.
Second, you're identifiying the ranges that need to be colored in it's own subroutine(?).
Third, you're then telling the program what to do with that subroutine once selected, and to color it based on the value of X (Select Case Rng("C1").Value
Case "X": ). Although, I don't quite understand the "C1" here. Is that identifying the column? or specifically cell C1??
Fourth, in the event value of Y is found, it would color it accordingly.
And lastly, end code

If that is at all incorrect, then you can ignore the rest of this (or continue reading because I'm going to incorporate my initial suggestion from above!).

Instead of selecting several ranges, what if I were to just identify 1 range (the table). Say, cells A1:L264 (I forget the exact range, I don't have the sheet open because it's at work and i don't have VPN access ). So it would read as-

Sub Main()
Range("E:E,G:G,J:J").Delete Shift:=xlToLeft
Color Range ("A1:L264")
End Sub

' Color the supplied range.
Sub Color(Rng)


Then, tell it to look in column L, and color based on Value Case "Phase". Then, tell it to color the second piece based on Value Case "Sub-Phase".

So:

Select Case Rng("L1").Value
Case "Phase": With Rng.Interior
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.799981688894314
End With
Case "Sub-Phase": With Rng.Interior
.ThemeColor = xlThemeColorDark1
.TintAndShade = -4.99893185216834E-02
End With
Case Else:
End Select
End Sub


Am I at all correct in interpreting the code and applying it in the above?
Reply With Quote