View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lift Off[_6_] Lift Off[_6_] is offline
external usenet poster
 
Posts: 1
Default 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