Selecting non-adjacent rows

  • Thread starter Thread starter Jon
  • Start date Start date
Jon

Here's one way:

Sub test()
Dim FormatRange As Range

With Sheets("Sheet1")
Set FormatRange = Union(.Rows(3), .Rows(6), .Rows(9))

FormatRange.Interior.ColorIndex = 3
End With

End Sub


--
Best Regards
Leo Heuser
MVP Excel

Followup to newsgroup only please.
 
I usually built up a range using Union and then select it:

Sub a()
Dim Counter As Integer
Dim Rg As Range
Set Rg = ActiveCell
For Counter = 1 To 10
Set Rg = Union(Rg, ActiveCell.Offset(Counter * 2))
Next
Rg.Select
End Sub
 
Jon, here is one way
Range("2:2,6:6,11:11,16:16,20:20").NumberFormat = "0.00_);[Red](0.00)"

--
Paul B
Always backup your data before trying something new
Using Excel 97 & 2000
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Back
Top