Sub selectrange()
Dim fr As Long
Dim lr As Long
fr = Range("MyRange").Row
lr = Range("MyRange").Cells(1, 1).Row + Range("MyRange").Rows.Count - 1
Worksheets("Sheet1").Rows(fr & ":" & lr).Select
End Sub
Dim i as long, j as long
i = Range("A1")
j= Range ("B1")
Range("MyRange").Rows("i:j").Select
This works for me provided the sheet with named range 'MyRange' on it is the active sheet and that the named range has workbook scope.
Code:Range("MyRange").Rows("10:16").Select
Dim i as long, j as long
i = Range("A1").Value
j= Range ("B1").Value
Range("MyRange").Rows(i & ":" & j).Select
To use variables try something like frank_AL suggested but replace fr and lr with i and j respectively.
Code:Dim i as long, j as long i = Range("A1").Value j= Range ("B1").Value Range("MyRange").Rows(i & ":" & j).Select