craigexcel
Active Member
- Joined
- Jun 28, 2006
- Messages
- 298
- Office Version
- 2016
- Platform
- Windows
Using Office 365 in the office.
I have a workbook with 1 sheet for dumping raw data to (Copy / Paste), along with 8 other sheets for operational States' data, for which relevant data is displayed via FILTER function formula.
At each quarter, to save each States' data in its own separate workbook, I was previously running my VBA from my PERSONAL.XLSB.
In the interest of making the (initial) data workbook a standalone workbook, I saved the workbook as .xlsm, and included the code in "This Worksheet".
Now, of course, there seems to be an issue with the following, where I add a new Sheet to the workbook, and then build up 2 Pivot Tables, starting with the one referenced below, which worked fine when run from PERSONAL.XLSB:
I'd appreciate your insight as to the cause and necessary fix. Thanks.
I have a workbook with 1 sheet for dumping raw data to (Copy / Paste), along with 8 other sheets for operational States' data, for which relevant data is displayed via FILTER function formula.
At each quarter, to save each States' data in its own separate workbook, I was previously running my VBA from my PERSONAL.XLSB.
In the interest of making the (initial) data workbook a standalone workbook, I saved the workbook as .xlsm, and included the code in "This Worksheet".
Now, of course, there seems to be an issue with the following, where I add a new Sheet to the workbook, and then build up 2 Pivot Tables, starting with the one referenced below, which worked fine when run from PERSONAL.XLSB:
VBA Code:
Sheets.Add 'this line executes, but no Sheet is added to the workbook
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ 'this line causes "Run-time error '5': Invalid procedure call or argument"
"Sheet1!R1C1:R" & iLastRow & "C19", Version:=8).CreatePivotTable TableDestination:= _
"Sheet2!R3C1", TableName:="pivot_mgr", DefaultVersion:=8
I'd appreciate your insight as to the cause and necessary fix. Thanks.