Hello,
Can someone assist. I'm fiddling around with some basic VBS programming.
When I want to select multiple rows (i.e 3-9) from an sheet I can use
Rows(" 3 , 9 ").select
However what should I do when one of those argument is a variable.
I.E.
varrow = 9
rows("3, varrow").select
This does not do the trick??
Earl Kiosterud - 23 Jun 2007 17:49 GMT
Joe,
Startrow = 3
NumRows = 6
' One way:
Cells(Startrow, 1).Resize(NumRows, 1).EntireRow.Select
'Another:
Range(Cells(Startrow, 1), Cells(Startrow + NumRows - 1, 1)).EntireRow.Select

Signature
Earl Kiosterud
www.smokeylake.com
Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
> Hello,
>
[quoted text clipped - 11 lines]
>
> This does not do the trick??
Don Guillett - 23 Jun 2007 17:52 GMT
This will select row 33 but I suspect that is not what you want
Sub selectVariableRows()
myrow = 3
Rows("3," & myrow).Select
End Sub

Signature
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
> Hello,
>
[quoted text clipped - 11 lines]
>
> This does not do the trick??
Roger Govier - 23 Jun 2007 18:14 GMT
Hi
Almost there, just change it to
Rows("3:" & varrow).select

Signature
Regards
Roger Govier
> Hello,
>
[quoted text clipped - 12 lines]
>
> This does not do the trick??
Just Merks - 24 Jun 2007 09:49 GMT
Thanks. This what I was looking for.
> Hi
>
[quoted text clipped - 16 lines]
>>
>> This does not do the trick??