Hi,
I'm having great difficulty in trying to build a string to use as criteria in the GetPivotData method (not finding the data in the pivot table). Can anyone advise where I'm going wrong?
Any help will be much appreciated.
Thanks,
K
My code:
' Get PivotData for total number of patients in April for chosen contract number.
On Error Resume Next
Set rngTableItem = ActiveCell. _
PivotTable.GetPivotData("PATIENT NAME (PLEASE USE CAPITALS)", "Daylist Month Name", "April", pivotStr)
wb1.Worksheets("Contract").Range("G3").Value = rngTableItem.Value
Set rngTableItem = Nothing
pivotStr contents in immediate window:
"Contract Number", 198226 Happy Teeth Hackney
pivotStr in VBA code:
pivotStr = Chr(34) & "Contract Number" & Chr(34) & ", " & contractVal
I'm having great difficulty in trying to build a string to use as criteria in the GetPivotData method (not finding the data in the pivot table). Can anyone advise where I'm going wrong?
Any help will be much appreciated.
Thanks,
K
My code:
' Get PivotData for total number of patients in April for chosen contract number.
On Error Resume Next
Set rngTableItem = ActiveCell. _
PivotTable.GetPivotData("PATIENT NAME (PLEASE USE CAPITALS)", "Daylist Month Name", "April", pivotStr)
wb1.Worksheets("Contract").Range("G3").Value = rngTableItem.Value
Set rngTableItem = Nothing
pivotStr contents in immediate window:
"Contract Number", 198226 Happy Teeth Hackney
pivotStr in VBA code:
pivotStr = Chr(34) & "Contract Number" & Chr(34) & ", " & contractVal