This code counts the number of non-blank cells in the selected range.
VBA Code:
Sub CountNonBlankCells()
Dim count As Long
count = Application.WorksheetFunction.CountA(Selection)
MsgBox "Count: " & count
End Sub
This code counts the number of non-blank cells in the selected range.
VBA Code:
Sub CountNonBlankCells()
Dim count As Long
count = Application.WorksheetFunction.CountA(Selection)
MsgBox "Count: " & count
End Sub