![]() |
|
#11
|
||||
|
||||
|
In that case, here's what I think your program might look like:
Code:
Sub Main()
Range("E:E,G:G,J:J").Delete Shift:=xlToLeft
For jr = 1 To 264
Set ce = Range("L" & jr)
Select Case ce.Value
Case "Phase"
ce.ThemeColor = xlThemeColorLight2
ce.TintAndShade = 0.799981688894314
Case "Sub-Phase"
ce.ThemeColor = xlThemeColorDark1
ce.TintAndShade = -4.99893185216834E-02
Case Else
End Select
Next jr
End Sub
Code:
Sub Main() . . . End Sub Code:
Range("E:E,G:G,J:J").Delete Shift:=xlToLeft
Code:
For jr = 1 To 264
Set ce = Range("L" & jr)
.
.
.
Next jr
The first statement I wrote inside the "loop", the underlined statement, works like this: 1) Start with the letter 'L' 2) Stick the current value of JL on the end of it—so throughout the loop it's "L1", "L2", "L3" and so on up to "L264". 3) Take that concatenation of "L" and the number and use the result in the Range method; so throughout the loop we're talking about Range("L1"), Range("L2") and so on. 4) Set "ce" to point to that range, so that for the rest of that iteration of the loop, "ce" means "Range(L-whatever)". You don't have to use "ce" as the name of this pointer; you can pick pretty much anything. I like short names, and "ce" means "Cell" to me. So inside the loop, "ce" means cell L1, L2, L3 and so on. And by the way you don't have to use "jr" as the name of the loop index, either. Out of habit I use 'j' and one letter for my loop counters, and the 'r' in "jr" just means "row". But you can name it anything you like. Code:
Select Case ce.Value
Case "Phase"
ce.ThemeColor = xlThemeColorLight2
ce.TintAndShade = 0.799981688894314
Case "Sub-Phase"
ce.ThemeColor = xlThemeColorDark1
ce.TintAndShade = -4.99893185216834E-02
Case Else
End Select
What I hope is that by now you see what this does, and can tell me whether it's what you want it to do. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Formatting contents after Tab of continuous lines or formatting specific area of word | pawii | Word | 1 | 05-12-2014 05:24 AM |
| macros | stebrownsword | Word VBA | 0 | 08-28-2013 01:16 AM |
How to do Formatting Using Macros
|
anju16saini | Word VBA | 1 | 03-11-2013 04:15 AM |
Formatting with macros
|
WaltR | Word VBA | 8 | 05-15-2012 06:28 PM |
| Macros | nore | Outlook | 0 | 06-01-2011 04:39 PM |