Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default pivot cache in VBA

Hi,
I want to create a pivot cache using VBA. If I write

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:=
_
"A1:AC3167").CreatePivotTable TableDestination:="", _
TableName:="myPivotTable",
DefaultVersion:=xlPivotTableVersion10

it works. But if I write

myLastRow = Range("A1").End(xlDown).Row
myLastColumn = Range("A1").End(xlToRight).column
myRange = Range(Cells(1, 1), Cells(myLastRow, myLastColumn))

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase,
SourceData:= _
myRange).CreatePivotTable TableDestination:="", _
TableName:="myPivotTable",
DefaultVersion:=xlPivotTableVersion10

I get an "Type Mismatch" error. I tried various structures from for
the myRange, but none worked.

Any help apreciated.

Ben

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple pivot tables from 1 pivot cache sugargenius Excel Programming 0 February 22nd 07 07:41 PM
Pivot Cache Mike D. Excel Programming 1 December 28th 06 06:43 PM
reading pivot cache witek Excel Programming 1 July 10th 06 07:59 PM
Pivot cache Kreed Excel Discussion (Misc queries) 0 November 14th 05 09:17 PM
Pivot Cache Memory Jared Excel Programming 0 December 16th 04 04:31 PM


All times are GMT +1. The time now is 04:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"