select multiple rows using variables

J

JLR-Mart

I have a program where I want to select a range of rows but don't know the
row numbers as these are stored as variables e.g. startrow and endrow. How
can I select rows startrow through endrow?

rows("startrow:endrow").select doesn't work and it appears that this
method must have numbers as the input e.g. rows("28:34").select

anyone know how I might acheive this?
 
G

Gary''s Student

Sub aRowsByAnyOtherName()
alpha = 13
omega = 17
Rows(alpha & ":" & omega).Select
End Sub
 
D

Don Guillett

Sub selectvarrows()
startrow = 12
endrow = 14
Rows(startrow & ":" & endrow).Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top