Hello guys!
I am working to try and create a macro that will create a pivot table automatically without me having to go and create it every single time I download some data. I run a report every day, and pivot off of it, so its kind of a pain to do that every day. Anyway, I wrote some code to do this, and was going to assign it to a button, but when I click the button I am getting an error. The error I am getting is listed below, as well as the code.
Error Message:
Run-time error '5':
Invalid procedure call or argument
The code I am using that is highlighted as erroring out:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Testing Data!R1C1:R2038C24", Version:=xlPivotTableVersion10). _
CreatePivotTable TableDestination:="Sheet2!R3C1", TableName:="PivotTable3" _
, DefaultVersion:=xlPivotTableVersion10
Can someone give me a hand with this, can't figure out why this code is erroring...
Thank you in advance, I appreciate the help!
~Andrew
I am working to try and create a macro that will create a pivot table automatically without me having to go and create it every single time I download some data. I run a report every day, and pivot off of it, so its kind of a pain to do that every day. Anyway, I wrote some code to do this, and was going to assign it to a button, but when I click the button I am getting an error. The error I am getting is listed below, as well as the code.
Error Message:
Run-time error '5':
Invalid procedure call or argument
The code I am using that is highlighted as erroring out:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Testing Data!R1C1:R2038C24", Version:=xlPivotTableVersion10). _
CreatePivotTable TableDestination:="Sheet2!R3C1", TableName:="PivotTable3" _
, DefaultVersion:=xlPivotTableVersion10
Can someone give me a hand with this, can't figure out why this code is erroring...
Thank you in advance, I appreciate the help!
~Andrew