Not entirely sure why you need to use an array.
Option Explicit
Sub CountLoggedOn()
Dim lLR As Long, lLoggedOn As Long
Dim awf As WorksheetFunction: Set awf = WorksheetFunction
' determine how many cells to include (using column A)
lLR = Range("A" & Rows.Count).End(xlUp).Row
' count the non-blank cells for the next column
lLoggedOn = awf.CountA(Range("A1").Offset(0, 1).Resize(lLR))
' display the count
MsgBox lLoggedOn
End Sub
This could be made into a function and, if required, called from the worksheet.
Formula:
=fCountLoggedOn()
Function fCountLoggedOn()
Dim lLR As Long, lLoggedOn As Long
Dim awf As WorksheetFunction: Set awf = WorksheetFunction
' determine how many cells to include (using column A)
lLR = Range("A" & Rows.Count).End(xlUp).Row
' count the non-blank cells for the next column
lLoggedOn = awf.CountA(Range("A1").Offset(0, 1).Resize(lLR))
' display the count
fCountLoggedOn = lLoggedOn
End Function
Sub sTest_fCountLoggedOn()
MsgBox fCountLoggedOn
End Sub
This relates specifically to column A although it could be amended to work with any range.
Regards, TMS
Bookmarks