Is there a way to count the used rows in a specified column?
Preferably without using the end(xlUp) or end(xlDown) method.
I was hoping for something like:
MsgBox ActiveSheet.UsedRange.Columns.Count MsgBox ActiveSheet.UsedRange.Rows.Count
Is there a way to count the used rows in a specified column?
Preferably without using the end(xlUp) or end(xlDown) method.
I was hoping for something like:
MsgBox ActiveSheet.UsedRange.Columns.Count MsgBox ActiveSheet.UsedRange.Rows.Count
- I HAVE NO IDEA WHAT I'M DOING
Depends what you're after; you can count the non-empty cells in a column with a worksheet function:
=COUNTA(F:F)
or in vba:
msgbox application.counta(activesheet.columns("F"))
If you're wanting to find the first and last used cells there will be other ways, perhaps including range.find, or SpecialCells.
Come back if that's the case.
p45cal
Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.
Thank you p45al,
application.counta(activesheet.columns("F")) will get the job done.
The simplest solution is often the hardest to see.
- I HAVE NO IDEA WHAT I'M DOING