I am working on a macro to create a Pivot Table for a dynamic named range "DATA". I get a "Run-time error '1004' Method 'Range' of object'_Global' failed. From what I see on other posts it may be because I am not referencing a specific sheet? How would I correct for this?
With ActiveWorkbook.Names("DATA")
.Name = "DATA"
.RefersToR1C1 = _
"=OFFSET('Closed Cases'!R1C2,0,0,COUNTA('Closed Cases'!C6),25)"
.Comment = ""
End With
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
Range("DATA"), Version:=xlPivotTableVersion14).CreatePivotTable TableDestination:= _
"'External Analytics!'R1C15", TableName:="PivotTable3", DefaultVersion:= _
xlPivotTableVersion14
Sheets("External Analytics").Select
Cells(1, 1).Select
With ActiveSheet.PivotTables("PivotTable3").PivotFields("Resolver")
.Orientation = xlRowField
.Position = 1
End With
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ Range("DATA"), Version:=xlPivotTableVersion14).CreatePivotTable TableDestination:= _ "'External Analytics!'R1C15", TableName:="PivotTable3", DefaultVersion:= _ xlPivotTableVersion14
– Ryan HuletActiveWorkbook.Names("DATA").Name = "DATA"
? Huh? – Comintern