Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot Range Name
I have a macro I recorded and am now trying to tweek with VBA to make i
more accurate. In the recorder I got the pivot source from naming large cell range, some of which I don't need. Trying to make the source dynamic but first was just trying to "name the range for the source data to pull from. Here's the pivo generation statement: ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData: "R2C1:R2800C26").CreatePivotTable _ TableDestination:="", TableName:="PivotTable4" Trying to name a range to replace "R2C1:R2816C26", but get an erro code when it runs. Below is the code to set the range name. Dim RawData As Range Set RawData = Range("R2C1:R2800C26") Get "error 1004, Method 'Range' of object '_Global failed" What am I doing wrong? TIA Lift Of -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot Range Name
According to VBA Help, RANGE has to be in A1 style
notation. Yours is R1C1. Cheers, Pete. -----Original Message----- I have a macro I recorded and am now trying to tweek with VBA to make it more accurate. In the recorder I got the pivot source from naming a large cell range, some of which I don't need. Trying to make the source dynamic but first was just trying to "name" the range for the source data to pull from. Here's the pivot generation statement: ActiveWorkbook.PivotCaches.Add(SourceType:=xlData base, SourceData:= "R2C1:R2800C26").CreatePivotTable _ TableDestination:="", TableName:="PivotTable4" Trying to name a range to replace "R2C1:R2816C26", but get an error code when it runs. Below is the code to set the range name. Dim RawData As Range Set RawData = Range("R2C1:R2800C26") Get "error 1004, Method 'Range' of object '_Global failed" What am I doing wrong? TIA Lift Off --- Message posted from http://www.ExcelForum.com/ . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot Range Name
Pete: I had printed off and marked that line with a hi-liter, but di
not make the connection as recording the macro listed it in relativ style. Lesson learned! Thanks for taking the time to help me. Lif Of -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Duplicating Pivot Chart / Changing Pivot Chart data range | Excel Discussion (Misc queries) | |||
Pivot table and value range | Excel Discussion (Misc queries) | |||
Edit the range of a pivot table | Excel Worksheet Functions | |||
Pivot Table Range | Excel Worksheet Functions | |||
Dynamic range in Pivot table | Excel Discussion (Misc queries) |