How do I programmatically select various ranges in vba?
From what I understand you must use Application.Union to combine large Range
groups in vba to use in Excel.
Somthing like...
Dim BigRange as Range, R(10) as String
R(1) = "1:1, 3:3"
R(2) = "7:7, 20:20, 43:43"
R(3) = "100:100"
Set BigRange = Application.Union ( Range (R(1)), Range (R(2)), Range
(R(3)) )
BigRange.Select
Which is fine and dandy with just the 3, but if I had a hundred or so ranges
how would I create a loop statment to combine the various ranges.
*The ranges would contain the entire row of a worksheet and only values from
the first column that contain the text "PICK ME!" would be selected.
Any help is much appreciated!
|