Dear All,
I am a newbie in writing VBA and has absolutely no clue to how to write one (apart from relying on tutorials). I have written the following and got stuck
Sub test()
Dim rng As Range
Dim x As Long
For x = 2 To 100 Step 6
If rng Is Nothing Then
Set rng = Range(Cells(x, 1), Cells(x, 18))
Else: Set rng = Union(rng, Range(Cells(x, 1), Cells(x, 18)))
End If
Next x
rng.Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
End With
End Sub
My spreadsheet consist of 3 rows of numbers for every sample, and I want to highlight with grey every three rows at a time to tell one apart from another. With the current strings I can only highlight one row, anyone knows how to expand the selection?
Bookmarks