98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Excel vba
Excel vba
Resolved · 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 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
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Undo Entries In RecordsTo Undo any entries or changes in records: |