(Orig. posted at Mr. Excel, though I've added since:
http://www.mrexcel.com/forum/showthread.php?t=436935 )
What I want: a COUNTA function on my pivottable (highlighted where I want it) so I can track how many clients overall (16), and how many per employee (John has __ clients, Sally has __, etc). I think I can do this with a WorkSheet_Change sub...but I do not have it perfected.
what do I need to change to fix it so it will do the above? Here's what I attempted, and I've attached some sample data/table
[vba]
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Abba As Long
If Target.Address = "$B$1" Then
Application.EnableEvents = False
Abba = Application.WorksheetFunction.CountA(Range("A1:A1000"))
'counts clients served; the minus 4 is so it doesn't count the
'header and total cells
With Range("C2")
Target("C2") = Abba - 4
End With
End If
End Sub[/vba]