excel vba

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

Excel vba

resolvedResolved · Low Priority · Version 2003

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

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

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Undo Entries In Records

To Undo any entries or changes in records:

Hit the ESC key once for the current field

And ESC twice for current record

View all Access hints and tips


Server loaded in 0.05 secs.