Something wrong with my pivot notation 2 line shows an error but if I put "4" instead of "lastRow" it works. What am I doing wrong?. How to change fixed range into dynamic?
Dim lastRow As Integer
Set pc = ActiveWorkbook.PivotCaches.Create(xlDatabase, "Sheet1!R1C1:R10C" & "lastRow")
Set pt = pc.CreatePivotTable(Range("I2"))