Sub pjCount()
Dim r As Long
r = Sheets("Inquery").[A65536].End(xlUp).Row
ActiveSheet.PivotTables("A3").PivotCache.SourceData = _
"Inquery!R2C2:R" & r & "C4"
ActiveSheet.PivotTables("A3").PivotCache.Refresh
End Sub
原文:https://www.cnblogs.com/luoye00/p/10900492.html