Uses nested For/Next loops to count the total number of cells used in all open worksheets:
Public Sub numCells() Dim I As Integer Dim K As Integer Dim numCells As Long
For K = 1 To Workbooks.Count 'Loop through workbooks
Workbooks(K).Activate
For I = 1 To Worksheets.Count 'Loop through worksheets
numCells = numCells + Worksheets(I).UsedRange.Count
Next I
Next K
MsgBox (numCells) End Sub