I am trying to code a dynamic range for a pivot table. I have tried
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=Sheets("FMRTReport.rdl").Range("$A$2:$V$" & LastRow), Version:=xlPivotTableVersion10). _
CreatePivotTable TableDestination:="ActiveCharts!R1C1", TableName:="PivotTable2" _
, DefaultVersion:=xlPivotTableVersion10
where LastRow is a String variable initialized with
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
I have also tried creating a variable defined as a range and substituting it in the formula. Nothing seems to be working. Can anyone help me? I am a basic user, so the easier the solution the better.
Thanks so much!!!
Bookmarks