Dynamic Range.Select

Ed S.

Board Regular
Joined
Mar 26, 2002
Messages
90
I need a technique to .Select a range of cells that are based on stored column and row values.

Range("A1:Z10).Select is a "hard coded method and does not fit my needs.

I first position to the first cell and save the cell values using:
StartRow = ActiveCell.Row
StartCol = ActiveCell.Column

then, locate end cell and similarly save:
EndRow = ActiveCell.Row
EndCol = ActiveCell.Column

The results of save are:
StarRow = 1
StartCol = 1
EndRow = 10
EndCol = 26

These values define the points of my cell range.

How do I .Select this range? The following is close, but incomplete....

Range(Columns(SCol),Columns(ECol)).Select
*********************************************
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi,

How about:-

Range(Cells(startrow, startcol), Cells(endrow, endcol)).Select


Hope it helps,
D
 
Upvote 0
On 2002-03-27 11:00, Ed S. wrote:
I need a technique to .Select a range of cells that are based on stored column and row values.

Range("A1:Z10).Select is a "hard coded method and does not fit my needs.

I first position to the first cell and save the cell values using:
StartRow = ActiveCell.Row
StartCol = ActiveCell.Column

then, locate end cell and similarly save:
EndRow = ActiveCell.Row
EndCol = ActiveCell.Column

The results of save are:
StarRow = 1
StartCol = 1
EndRow = 10
EndCol = 26

These values define the points of my cell range.

How do I .Select this range? The following is close, but incomplete....

Range(Columns(SCol),Columns(ECol)).Select
*********************************************

Range(Cells(StartRow, StartCol),Cells(EndRow, EndCol)).Select

Hope this helps,

Russell
 
Upvote 0

Forum statistics

Threads
1,214,620
Messages
6,120,554
Members
448,970
Latest member
kennimack

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top