Select Rows, based on Cell Values

DrDave6

New Member
Joined
Oct 1, 2014
Messages
20
Hello,

If I want to select rows 5 to 10, inclusive, I can use this statement:

Rows("5:10").Select

However, to make this more dynamic, I have stored the start row in A1 and the end row in A2.

What would the select statement look like, if I wanted it to use A1 and A2?

Also, do A1 and A2 have to be formatted as text, for this to work?

Thank you.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try

Code:
Rows(Range("A1").Value & ":" & Range("A2").Value).Select

Cell formatting should not matter.
 
Upvote 0
Works perfectly. Plus, being able to specify coordinates that are contained within cells opens up a world of possibilities.

Thank you.
 
Upvote 0
A quick follow-up if I may....

What would the statement look like, if I wanted the first row to always be 16?

Thank you.
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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