ItalianPlatinum
Well-known Member
- Joined
- Mar 23, 2017
- Messages
- 848
- Office Version
- 365
- 2019
- Platform
- Windows
I am looking to change the data source of my VBA. But getting syntax error when doing the below. What am I doing wrong? I can't even get it to work for a simple A2 - V100. Eventually I want the 100 to be set by my lr.
My data will always start on A2 to V but the amount of data could change that is why I am trying to use LR.
My data will always start on A2 to V but the amount of data could change that is why I am trying to use LR.
VBA Code:
lr = Cells(rows.count, "B").End(xlUp).row
Sheets("Pivot Table").PivotTables("PivotTable1").ChangePivotCache Sheets("Pivot Table").
PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Transaction!$A$2:$V$100", Version:=8)