pbornemeier
Well-known Member
- Joined
- May 24, 2005
- Messages
- 3,915
I have been using a group of procedures for over a year and had made no changes to them. They ran fine on day X with one set of data, but on day X+1 it failed with a Run Time Error 13, Type mismatch (with a different set of data) on this line of code.
The code is in a standard module of Analysis v1.48.xlsm
I swapped to the old set of data and got no error, but when I examined the new set of data but could not see any error values or conditions that I could recognize as a reason for this error.
When that line of code is executing, the Combined worksheet is active.
I made the change suggested in this thread by Mike in post #2 (which was add .Address(,,,True) to the address) and the code worked again. Looking at the XL2007 object model entry for the 4th parameter of Range.Address:
External (Optional Variant) True to return an external reference. False to return a local reference. The default value is False.
When I examine the address with the External parameter set to False , I see:
$A$1:$AJ$2651
When it is set to True I see:
'[Analysis v1.48.xlsm]Combined'!$A$1:$AJ$2651
If the Combined worksheet is active, why would the code fail with the local version of the address?
I am in a corporate environment. Could some recent Excel 2007 update cause this?
Code:
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
Worksheets("Combined").Range("A1").CurrentRegion).CreatePivotTable _
TableDestination:="", TableName:="xyzzy", DefaultVersion:=xlPivotTableVersion10
I swapped to the old set of data and got no error, but when I examined the new set of data but could not see any error values or conditions that I could recognize as a reason for this error.
When that line of code is executing, the Combined worksheet is active.
I made the change suggested in this thread by Mike in post #2 (which was add .Address(,,,True) to the address) and the code worked again. Looking at the XL2007 object model entry for the 4th parameter of Range.Address:
External (Optional Variant) True to return an external reference. False to return a local reference. The default value is False.
When I examine the address with the External parameter set to False , I see:
$A$1:$AJ$2651
When it is set to True I see:
'[Analysis v1.48.xlsm]Combined'!$A$1:$AJ$2651
If the Combined worksheet is active, why would the code fail with the local version of the address?
I am in a corporate environment. Could some recent Excel 2007 update cause this?