ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Dynamic Range Selection Using VBA (https://www.excelbanter.com/excel-discussion-misc-queries/254180-dynamic-range-selection-using-vba.html)

tek

Dynamic Range Selection Using VBA
 
What I'm trying to accomplish is to be able to run a procedure that selects a
range based on a number provided in another cell. For example; if the number
10 is in cell A1, then cells A20:A30 would be selected when I run the macro.
If the number 6 is provided, then cells A20:A26 would be selected. Not sure
where to start, so any help is appreciated.

Gary Keramidas

Dynamic Range Selection Using VBA
 
this may do what you want
range("A20").Resize(range("A1").Value+1).select

--


Gary Keramidas
Excel 2003


"TEK" wrote in message
...
What I'm trying to accomplish is to be able to run a procedure that selects a
range based on a number provided in another cell. For example; if the number
10 is in cell A1, then cells A20:A30 would be selected when I run the macro.
If the number 6 is provided, then cells A20:A26 would be selected. Not sure
where to start, so any help is appreciated.



tek

Dynamic Range Selection Using VBA
 
Gary,

That did it. Thank you for your help.

"Gary Keramidas" wrote:

this may do what you want
range("A20").Resize(range("A1").Value+1).select

--


Gary Keramidas
Excel 2003


"TEK" wrote in message
...
What I'm trying to accomplish is to be able to run a procedure that selects a
range based on a number provided in another cell. For example; if the number
10 is in cell A1, then cells A20:A30 would be selected when I run the macro.
If the number 6 is provided, then cells A20:A26 would be selected. Not sure
where to start, so any help is appreciated.


.



All times are GMT +1. The time now is 09:45 PM.

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