excel vba
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Excel vba

Excel vba

resolvedResolved · Low Priority · Version 2003

replyReply Fri 9 May 2008, 16:47Delegate Nam said...

Nam has attended:
Access Introduction course
Access Intermediate course
Access VBA course
Access Advanced course

Excel vba

How do I do a count of the number of filled rows in a spreadsheet so that for e.g. I can write a loop to go through all of them

For upcoming training course dates see: Pricing & availability

replyReply Mon 12 May 2008, 11:59Trainer Roy said...

RE: Excel vba

Nam,

Provided that your data is in a sold block (no blank rows), you can use CurrentRegion (equivalent to doing Ctrl-*).

Assume that you have named the first cell in your data as "Datastart", then try something like this:

Dim dataregion As Range 'the existing block of data
Dim recordcount As Integer

Worksheets("Orders").Activate 'need to do this before selecting
Range("DataStart").Select 'the first data cell
Set dataregion = ActiveCell.CurrentRegion
recordcount = dataregion.Rows.Count 'assuming no header row


/Roy

 

Please browse our web site to find out more about
microsoft access course and other Microsoft training courses.

Access tip:

Create An Inaccessible Field On A Form

There is sometimes a need to make a field in a form look like a normal field but be completely inaccessible to the user. To do this:

In the Field's Properties
Set the ENABLED property to No
Set the LOCKED property to Yes

The field will not grey out, but the user will not be able to do anything with it.

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard