Sub PanTotal()
Dim LastC As Long, LastR As Long, SumR As Long, tStart As String
Dim tStartR As Long, tStartC As Long
'
tStart = "B4" '<<< The TopLeft Address of the Table with Salary/Quantity
SumR = 0 '<<< The Row that will be used fot the Total; if ZERO means "at the bottom"
'
LastC = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
LastR = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).row
On Error GoTo 0
If SumR = 0 Then SumR = LastR + 2
tStartR = Range(tStart).Cells(1, 1).row
tStartC = Range(tStart).Cells(1, 1).Column
Cells(SumR, tStartC).Resize(1, LastC).ClearContents
For I = tStartC To LastC Step 2
Cells(SumR, I + 1).Value = Application.WorksheetFunction.CountA(Cells(tStartR, I + 1).Resize(LastR, 1))
Next I
End Sub