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 / Programming / February 2006

Tip: Looking for answers? Try searching our database.

Simple Count problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul987 - 28 Feb 2006 16:03 GMT
Obviously new to VBA.

I want to run a while function depending on the number of rows on
second sheet.  ex..

a = 1
While a <= Sheet(2).rows.count
a = a + 1
..
this doesn't work.  Any help.  Thanks much
Toppers - 28 Feb 2006 16:34 GMT
One way:

This will loop through all rows based on row count of column A and assumes
row 1 is a header; adjust starting value of r (=2) and column as required.

Dim lastrow as Long, r as long

lastrow=Sheet(2).Cells(rows.count,"A").end(xlup).row
For r=2 to lastrow
......

Next r

HTH

> Obviously new to VBA.
>
[quoted text clipped - 6 lines]
> ...
> this doesn't work.  Any help.  Thanks much.
Paul987 - 28 Feb 2006 19:59 GMT
very nice.  thank you.

Signature

Paul987

 
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.