D
Dan Thompson
I have used this line of code many times in programs in order to get VBA to
select a row or multiple rows here is the code.
Rows("10:10").Select 'This will select row 10
Or
Rows("10:50").Select 'This will select rows 10 thru 50
But when I use a variable for the Integers in the two lines of code above I
get errors.
for example.
Sub Test()
Dim X As Integer, Y As Integer
X = 10
Y = 10
With Worksheets(1)
Rows("X:Y").Select '*****THIS LINE PRODUCES AN ERROR Why ?
Rows(X:Y).Select '******THIS LINE ALSO PRODUCES AN ERROR Why ?
End Sub
Any HELP on this would be very much Appreciated
Thanks,
Dan Thompson
select a row or multiple rows here is the code.
Rows("10:10").Select 'This will select row 10
Or
Rows("10:50").Select 'This will select rows 10 thru 50
But when I use a variable for the Integers in the two lines of code above I
get errors.
for example.
Sub Test()
Dim X As Integer, Y As Integer
X = 10
Y = 10
With Worksheets(1)
Rows("X:Y").Select '*****THIS LINE PRODUCES AN ERROR Why ?
Rows(X:Y).Select '******THIS LINE ALSO PRODUCES AN ERROR Why ?
End Sub
Any HELP on this would be very much Appreciated
Thanks,
Dan Thompson