multiple selection problem

  • Thread starter Thread starter XLNT
  • Start date Start date
X

XLNT

How can i code muliple selections say i want to select rows 3,5,7
together

like

Rows(3).select
Rows(5).select
Rows(7).select
 
Use Union

for i = 3 to 7 step 2
if rng is nothing then
set rng = Rows(i)
else
set rng = Union(rng,rows(i))
Next

or

set rng = Range("A3,A5,A7").EntireRow

demo from the immediate window:
set rng = Range("A3,A5,A7").EntireRow
? rng.Address
$3:$3,$5:$5,$7:$7

so also
set rng = Range("3:3,5:5,7:7")

demo from the immediate window:
set rng = Range("3:3,5:5,7:7")
? rng.Address
$3:$3,$5:$5,$7:$7
 
Back
Top