R
rvExcelTip
I've lost several productive(?) hours (stupid me) investigating th
extremely helpful -ERROR 13: Types do not correspond- Message on th
following case:
I had written a rather complicated VBA formula continued on two line
as follows:
a_varValues
rngYLabel.Offset(lngRunIndex + 1
rvxlColumnNameToNumber(c_strKolomEersteWeek) & _
-rvxlColumnNameToNumber(c_strKolomAfdelingsNaam)).Resize(1
intLastWeek).Value
where a_varValues was Dimmed as a Variant and rngYLabel was a singl
cell (valid) range.
Excel systematically refused to execute the statement with the abov
error message as an excuse.
After having tried all sorts of alternatives, I finally wrote th
statement on a single line:
a_varValues
rngYLabel.Offset(lngRunIndex + 1
rvxlColumnNameToNumber(c_strKolomEersteWeek)
rvxlColumnNameToNumber(c_strKolomAfdelingsNaam)).Resize(1
intLastWeek).Value
and Bingo! it worked.
Further investigating the expression in the immediate window, I naile
down the cause of the error to the subexpression
?rvxlColumnNameToNumber(c_strKolomEersteWeek) & _
-rvxlColumnNameToNumber(c_strKolomAfdelingsNaam) which evaluated t
6-2
wheras the single line expression
rvxlColumnNameToNumber(c_strKolomEersteWeek)
rvxlColumnNameToNumber(c_strKolomAfdelingsNaam)
evaluates to 4. And that seems to make a whole difference.
1. Has somebody an explanation for this strange behaviour?
2. How can I properly split the expression, so that it can be viewe
without scrolling
extremely helpful -ERROR 13: Types do not correspond- Message on th
following case:
I had written a rather complicated VBA formula continued on two line
as follows:
a_varValues
rngYLabel.Offset(lngRunIndex + 1
rvxlColumnNameToNumber(c_strKolomEersteWeek) & _
-rvxlColumnNameToNumber(c_strKolomAfdelingsNaam)).Resize(1
intLastWeek).Value
where a_varValues was Dimmed as a Variant and rngYLabel was a singl
cell (valid) range.
Excel systematically refused to execute the statement with the abov
error message as an excuse.
After having tried all sorts of alternatives, I finally wrote th
statement on a single line:
a_varValues
rngYLabel.Offset(lngRunIndex + 1
rvxlColumnNameToNumber(c_strKolomEersteWeek)
rvxlColumnNameToNumber(c_strKolomAfdelingsNaam)).Resize(1
intLastWeek).Value
and Bingo! it worked.
Further investigating the expression in the immediate window, I naile
down the cause of the error to the subexpression
?rvxlColumnNameToNumber(c_strKolomEersteWeek) & _
-rvxlColumnNameToNumber(c_strKolomAfdelingsNaam) which evaluated t
6-2
wheras the single line expression
rvxlColumnNameToNumber(c_strKolomEersteWeek)
rvxlColumnNameToNumber(c_strKolomAfdelingsNaam)
evaluates to 4. And that seems to make a whole difference.
1. Has somebody an explanation for this strange behaviour?
2. How can I properly split the expression, so that it can be viewe
without scrolling