I used this before and with your code Charlize we can get the count, it's just getting the counts to the sheets before sending.
Private Sub cmdCreateTable_Click()
Dim strHead As String
Dim strSheetName As String
Dim strListAddress As String
Sheets(1).Range("A1:A163").Select
strHead = Selection.Cells(1, 1)
strSheetName = "'" & ActiveSheet.Name & "'!"
strListAddress = Selection.Address(ReferenceStyle:=xlR1C1)
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
strSheetName & strListAddress).CreatePivotTable TableDestination:="", TableName:="CountOf"
ActiveSheet.PivotTables("CountOf").AddFields RowFields:=strHead
With ActiveSheet.PivotTables("CountOf").PivotFields(strHead)
.Orientation = xlDataField
.Caption = "Count of" & strHead
.Function = xlCount
' End With
ActiveWorkbook.ShowPivotTableFieldList = False
Application.CommandBars("PivotTable").Visible = False
End With
End Sub
Thanking you for your support and time
Nurofen