I have this line in VBA
If (r.Offset(0, OfsPtile).Value < StdCut(i)) Then
The value on the sheet for r.Offset(0,OfsPtile).value is
--
(The character string "--" which is the result of an excel formula with IFERROR and "--" is the result when there is an error.
StdCut is dimensioned Double and has a value say .01
The above VBA statement evaluates to FALSE, not error. Why?
I am sure the value "--" is being compared in the VBA code as in the immediate window i type and get the following
?r.Offset(0, OfsPtile).Value
--
If i type the following in the immediate window, i get a VBA error
? "--" < .01
I want VBA to generate an error on the statement, not evaluate it as FALSE, just like it does in the immediate window
Is there an explanation for why the VBA IF statement evaluates as FALSE and not error?
Is there a workaround to use this IF statement and depend on it NOT evaluating to FALSE if it ends up comparing to a string?
Thank you.
If (r.Offset(0, OfsPtile).Value < StdCut(i)) Then
The value on the sheet for r.Offset(0,OfsPtile).value is
--
(The character string "--" which is the result of an excel formula with IFERROR and "--" is the result when there is an error.
StdCut is dimensioned Double and has a value say .01
The above VBA statement evaluates to FALSE, not error. Why?
I am sure the value "--" is being compared in the VBA code as in the immediate window i type and get the following
?r.Offset(0, OfsPtile).Value
--
If i type the following in the immediate window, i get a VBA error
? "--" < .01
I want VBA to generate an error on the statement, not evaluate it as FALSE, just like it does in the immediate window
Is there an explanation for why the VBA IF statement evaluates as FALSE and not error?
Is there a workaround to use this IF statement and depend on it NOT evaluating to FALSE if it ends up comparing to a string?
Thank you.