VBA: Count the Number of Used Rows
The following code will return in a message box the total number of rows used in a worksheet. Empty rows are considered used if data follows the empty row.
MsgBox ActiveSheet.UsedRange.Rows.Count
Can't get the tutorial to work for you? Need help with your code?
Get answers right away at our AE Excel Support Forums!
Get answers right away at our AE Excel Support Forums!



MsgBox ActiveSheet.UsedRange.Columns.Count
Works for columns’ number
You save my day! thanks, it really helps.
Not what I want.. I need to count the number of used ( non blank ) cells in a column that may or may not have blank cells. Esample column “AF” has cells in row 12, 35, 256. The answer is 3. There are 3 “used” cells in “AF”.
Try:
MsgBox WorksheetFunction.CountA(AF:AF)
Thanks a ton, wish I got this earlier
Thanks a ton!!!!