PivotCache.Create无法处理大范围

这运行正常:

Dim pc As PivotCache With tgtBook.Sheets("Data") Set pc = tgtBook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Range("A1:B5"), Version:=Excel.xlPivotTableVersion14) ' Range("myMthdata")) End With 

抛出运行时错误'13'types不匹配:

 Dim pc As PivotCache With tgtBook.Sheets("Data") Set pc = tgtBook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Range("A1:B500000"), Version:=Excel.xlPivotTableVersion14) ' Range("myMthdata")) End With 

唯一的区别是SourceData中的行数。 这是一个错误还是在这个看似不一致的背后有一个合乎逻辑的理由?


编辑

进一步调查,似乎B65536将工作,而任何更大的将bug。 这是旧版Excel中不是excel-2010的最大行数。 感觉像一个错误。

任何人都知道解决方法?

根据我的经验,如果使用R1C1样式引用而不是Range对象或A1样式string,效果会更好:

 Dim pc As PivotCache Set pc = tgtBook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:="Data!R1C1:R500000C2", Version:=Excel.xlPivotTableVersion14)