Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default select multiple rows using variables

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

--
Gary''s Student - gsnu200830
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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?




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select multiple rows not next to each other LarryJNX Excel Worksheet Functions 3 April 4th 23 02:20 PM
Using variables in Rows.Select Karen53 Excel Programming 5 September 3rd 07 11:12 AM
using variables to select multiple rows using a macro Chad Excel Programming 1 October 8th 06 11:22 PM
using variables to select multiple rows using a macro Chad Excel Programming 0 October 6th 06 03:31 PM
Count rows based on multiple variables Murph Excel Programming 3 October 27th 04 11:35 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"