View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Luzius Ron Luzius is offline
external usenet poster
 
Posts: 10
Default Variable Address in Pivot Table VBA code

How can I get a variable range in this VBA code instead of this hard-coded
range (R1C1:R1345C25)?

Every time I run my Excel macro, I will have a different amount of rows to
include in the PivotTable code.

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"'Total Open Discrepancies'!R1C1:R1345C25").CreatePivotTable
TableDestination _
:="", TableName:="PivotTable1"