Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / June 2007

Tip: Looking for answers? Try searching our database.

rows select using macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Just Merks - 23 Jun 2007 17:22 GMT
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??

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.