Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Type Mismatch when creating a pivottable macro
Hi,
I've been searching through this group for similar problems (and found one) but I was still unable to resolve the issue below. When I try to set bigcache, it throws a type mismatch at me and I'll be damned if I can work it out. Any help is much appreciated. My code is: Function consolidateData() Dim varArray(3) As Variant Dim headingNames As New Collection Dim bigcache As Variant headingNames.Add "Item1" headingNames.Add "Item2" headingNames.Add "Item3" For i = 2 To Sheets.Count - 1 varArray(i) = Array(Sheets(i). _ Range("A1").CurrentRegion.Address(external:=True, ReferenceStyle:=xlR1C1), _ headingNames(i - 1)) Next Set bigcache = ActiveWorkbook.PivotCaches.Add( _ SourceType:=xlConsolidation, _ SourceData:=varArray) bigcache.CreatePivotTable _ TableDestination:="", TableName:="PivotTable3", DefaultVersion:= _ xlPivotTableVersion13 ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1) ActiveSheet.Cells(3, 1).Select ActiveSheet.PivotTables("PivotTable1").DataPivotFi eld.PivotItems( _ "Count of Value").Position = 1 ActiveWorkbook.ShowPivotTableFieldList = True End Function |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Type Mismatch when creating a pivottable macro
I've been searching through this group for similar problems (and found one) but I was still unable to resolve the issue below. When I try to set bigcache, it throws a type mismatch at me and I'll be damned if I can work it out. Any help is much appreciated. My code is: <snip Dim bigcache As Variant Have you tried making bigcache a PivotCache instead of a Variant? Iain King |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error type mismatch in writing macro | Excel Worksheet Functions | |||
Macro error type mismatch | Excel Discussion (Misc queries) | |||
Visual Basic macro run time error(13) type mismatch | Excel Discussion (Misc queries) | |||
Creating a database and PivotTable with a Macro | Excel Programming | |||
Type mismatch | Excel Programming |