I'm so annoyed. I have tried numerous attempts at this using code others have posted and this simply won't work.
I'm simply trying to adjust my data range for a pre-existing pivot table to include the appropriate range. I have hard-coded the range (I was using variables for the rows but nothign works so i gave up). Even this code, with a defined data range, doesn't work:
I've tried other variations but keep getting a "Run time error 9: Subscript out of range error", but I really think the code should work. If I update the pivot table manually with this data range it works fine, so I don't think its the pivot table itself that's the issue.
I assume I'm missing something easy in my code, but can't see what it is.
I'm simply trying to adjust my data range for a pre-existing pivot table to include the appropriate range. I have hard-coded the range (I was using variables for the rows but nothign works so i gave up). Even this code, with a defined data range, doesn't work:
Code:
Sheets("Other Projects Detail").PivotTables("PivotTable1").SourceData = Sheets("ET").Range("J1:AO820").Address(True, True, xlR1C1, True)
I've tried other variations but keep getting a "Run time error 9: Subscript out of range error", but I really think the code should work. If I update the pivot table manually with this data range it works fine, so I don't think its the pivot table itself that's the issue.
I assume I'm missing something easy in my code, but can't see what it is.