ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select multiple rows using variables (https://www.excelbanter.com/excel-programming/423333-select-multiple-rows-using-variables.html)

JLR-Mart

select multiple rows using variables
 
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?

joel

select multiple rows using variables
 
Set MyRows =Rows(StartRow & ":" & EndRow)
MyRows.Select

"JLR-Mart" wrote:

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?


Gary''s Student

select multiple rows using variables
 
Sub aRowsByAnyOtherName()
alpha = 13
omega = 17
Rows(alpha & ":" & omega).Select
End Sub

--
Gary''s Student - gsnu200830

Mike H

select multiple rows using variables
 
Try this


startrow = 10
endrow = 12
Rows(startrow & ":" & endrow).Select

Mike

"JLR-Mart" wrote:

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?


Don Guillett

select multiple rows using variables
 
Sub selectvarrows()
startrow = 12
endrow = 14
Rows(startrow & ":" & endrow).Select
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JLR-Mart" wrote in message
...
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?



Dave Peterson

select multiple rows using variables
 
One mo

Rows(startrow).resize(endrow-startrow+1).select



JLR-Mart wrote:

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?


--

Dave Peterson

Don Guillett

select multiple rows using variables
 

Now if we could just all agree on a startrow and endrow
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
Sub selectvarrows()
startrow = 12
endrow = 14
Rows(startrow & ":" & endrow).Select
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JLR-Mart" wrote in message
...
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?





All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com