PDA

View Full Version : Counting Used Rows In Column - Best Method?



MINCUS1308
02-12-2018, 08:00 AM
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

p45cal
02-12-2018, 08:44 AM
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.

MINCUS1308
02-12-2018, 09:01 AM
Thank you p45al,
application.counta(activesheet.columns("F")) will get the job done.
The simplest solution is often the hardest to see.