Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting a Range Using Variables in Excel

Status
Not open for further replies.

OzzieOwl

Technical User
Dec 13, 2001
45
GB
Help, I need to select a range of rows in excel, but the range needs to be selected from the following varibles.

rowa - Start Row
rowb - End Row

I've tried everything I can think of, but keep getting selection errors.

Has anyone got any ideas ?
 
Hi MartinLymn

I think this is what you are looking for:

Code:
Sub test()
    Dim rowa As Integer
    Dim rowb As Integer

    rowa = 5
    rowb = 10

    Rows(rowa & ":" & rowb).Select

End Sub
[\code]

If not, what exactly do you want to do?

Nath
 
Thanks nath mate, thats brilliant.

Cheers Martin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top