I created a sub that automatically creates a pivot table based on a source range. The code works fine when the source data is a small range. However, when I run it on some bigger data (110’000 rows) I get run time error 13 (Type Mismatch).
I don’t understand why it does this. I can run the exact same code on another range, and all is well???
Does someone have a suggestion why this would happen?
Set rDataRange = wsData.Range("A1").CurrentRegion
' Create the cache
Set PTCache = ActiveWorkbook.PivotCaches.Create( _
SourceType:=xlDatabase, _
SourceData:=rDataRange)
This question appears to be asking (and answering) a very similar question: Type mismatch error when creating a pivot table in Excel with VBA
Are you absolutely sure your reference to the larger range is valid? Are you positive the larger range is not missing a header, doesn’t contain an extra blank row or column, doesn’t have any bad data?