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 |
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/ . |
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 |
All times are GMT +1. The time now is 12:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com