View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Can someone help me with this error?

Earlier versions of Excel required a string (not a range object) for the SourceData parameter, so
try this:

Dim MyData As Range
Set MyData = Sheets("Visible").Range("D3").CurrentRegion

Range("D3").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
MyData.Address(, , xlA1, True)).CreatePivotTable TableDestination:="", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:="created"

ActiveSheet.PivotTables("PivotTable1").PivotFields ("created").Orientation = _
xlDataField
Range("A4").Select
Selection.Group Start:=True, End:=True, Periods:=Array(False, False, True, _
False, False, False, False)


HTH,
Bernie
MS Excel MVP


"nbaj2k" wrote in message
...

That was a stupid error on my part, I just thought that it had to be in
quotes for some reason

I changed it and now I get a different error.

I listed what I have now below. I'm having problems with the same
section just getting a different error.

Now it is saying "Type mismath" and highliting this part.

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


Below is the whole section, in case that makes a difference.

I really appreciate your help.

~J

=======================

Dim MyData As Range
Set MyData = Sheets("Visible").Range("D3").CurrentRegion

Range("D3").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:=
_
MyData).CreatePivotTable TableDestination:="", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3,
1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable1").AddFields
RowFields:="created"

ActiveSheet.PivotTables("PivotTable1").PivotFields ("created").Orientation
= _
xlDataField
Range("A4").Select
Selection.Group Start:=True, End:=True, Periods:=Array(False,
False, True, _
False, False, False, False)


--
nbaj2k
------------------------------------------------------------------------
nbaj2k's Profile: http://www.excelforum.com/member.php...o&userid=36480
View this thread: http://www.excelforum.com/showthread...hreadid=563251