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:
Code:MsgBox ActiveSheet.UsedRange.Columns.Count
MsgBox ActiveSheet.UsedRange.Rows.Count
Printable View
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:
Code:MsgBox ActiveSheet.UsedRange.Columns.Count
MsgBox ActiveSheet.UsedRange.Rows.Count
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.
Thank you p45al,
application.counta(activesheet.columns("F")) will get the job done.
The simplest solution is often the hardest to see.