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
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
MsgBox ActiveSheet.UsedRange.Columns.Count
Works for columns’ number
You save my day! thanks, it really helps.