Selecting a range in VBA when you only have row/col NUMBERS

ratbags21

New Member
Joined
Jul 13, 2006
Messages
17
We are all familiar with the statement:

Range(A1:B4).select

But what if you do not have "A1" or "B4" but numbers eg

Top left co-ordinate=1,1 and the bottom right co-ordinate=
2,4 (you get these from activecell.row or activecell.column syntax when you are navigating around the range#

How do I select a range with row & column numbers only?

Many thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You could try this.

Range(Cells(1,1), Cells(2,4)).Select

Note there could be various issues with this code depending on your other code, and also you don't generally need to select a range to work with it.
 
Upvote 0
Hello,

something in the lines of

Code:
a = 10
b = 10
c = 12
d = 12
Cells(a, b).Select
Range(Selection, Cells(c, d)).Select
 
Upvote 0
Range selection problem

You could try this.

Range(Cells(1,1), Cells(2,4)).Select

Note there could be various issues with this code depending on your other code, and also you don't generally need to select a range to work with it.

Thank you very much - this is exactly what I want!
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,185
Members
449,071
Latest member
cdnMech

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