Updating PivotTable, why is the sourcedata limited?

RustE

New Member
Joined
Jun 3, 2009
Messages
2
Hi,

I'm working in excel 2007 but I appear to have a problem associated with the row limit from excel 2003. Can't figure it out exactly-

This code snippet works- it updates the pivottable with the order data from LargeModel, which is an input earlier


Code:
 ActiveSheet.PivotTables("PivotTable2").ChangePivotCache ActiveWorkbook. _
        PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Workbooks(LargeModel).Worksheets("OrderData").Range("A1:J65536") _
        , Version:=xlPivotTableVersion12)

However, if I try to enter a larger number than 65536, I get a "type mismatch" error. I guess this is the row limit from excel 2003, but I'm using 2007, so I don't know what's causing the error. :confused:

Any ideas?

Thanks!!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Have you checked to see if you have more than 65536 rows in your spreadsheet? If not (because it was previously a 2003 workbook) you will have to select Convert from the office button to unlock the extra rows.
 
Upvote 0
I checked on it, it is in 2007 and has more than 65536 rows.

I figured out a solution, so I'll post that:

Instead of entering the data range with range("A1:J100000"), this method seems to work. Thanks macro-recorder!
Putting in the extra [ and ] was something I hadn't thought of, but I think it needs them.

Code:
ActiveSheet.PivotTables("PivotTable2").ChangePivotCache ActiveWorkbook. _
        PivotCaches.Create(SourceType:=xlDatabase, SourceData:="[" & LargeModel & "]Order Data!C1:C10")
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top