G
Guest
Using XL 2003 & 97
The following code (Below ********) is just part of a Sub Routine.
For some reason IsNumeric() is returning a "True" even though the statement
should be false. (I could be wrong or do not understand IsNumeric() function)
What I mean is this:
The myFormulaStr is ="=(C47+C48+C49)"
PositionInmyFormula = 6 (Correctly, "+" is found in the sixth (6) position)
The 6th position + 1 should be the letter "C" ... therefore not numeric.
I would then expect the IsNumeric() to return false ... no?
Also, (in a copy of the following subroutine) I also test for a numeric
after the "=" sign. IsNumeric again returns a "True" even though the formula
is: =SUM(C16+C26+C35+C41+C44+C51)
In this case the value of PositionInmyFormula = 1 therefore,
PositionInmyFormula = 1 + 1 should be "S" ??
In the two (2) stuations above, why is IsNumeric() returning a "True" when a
False should be the result?
Thanks in Advance
Dennis
********** Sub Routine **********************************
Dim myCell, myRange As Range
Dim myFormulaStr As String
Dim PositionInmyFormula As Integer
myFormulaStr = myCell.Formula ' Formula is
=(C47+C48+C49)
PositionInmyFormula = InStr(myFormulaStr, "+") ' PositionInFormula is 6
If PositionInmyFormula > 0 Then
If Worksheet.Function.isumeric(Mid(myFormulaStr, _
PositionInmyFormula + 1, 1)) Then
myCell.Interior.ColorIndex = 8
End If
End If
The following code (Below ********) is just part of a Sub Routine.
For some reason IsNumeric() is returning a "True" even though the statement
should be false. (I could be wrong or do not understand IsNumeric() function)
What I mean is this:
The myFormulaStr is ="=(C47+C48+C49)"
PositionInmyFormula = 6 (Correctly, "+" is found in the sixth (6) position)
The 6th position + 1 should be the letter "C" ... therefore not numeric.
I would then expect the IsNumeric() to return false ... no?
Also, (in a copy of the following subroutine) I also test for a numeric
after the "=" sign. IsNumeric again returns a "True" even though the formula
is: =SUM(C16+C26+C35+C41+C44+C51)
In this case the value of PositionInmyFormula = 1 therefore,
PositionInmyFormula = 1 + 1 should be "S" ??
In the two (2) stuations above, why is IsNumeric() returning a "True" when a
False should be the result?
Thanks in Advance
Dennis
********** Sub Routine **********************************
Dim myCell, myRange As Range
Dim myFormulaStr As String
Dim PositionInmyFormula As Integer
myFormulaStr = myCell.Formula ' Formula is
=(C47+C48+C49)
PositionInmyFormula = InStr(myFormulaStr, "+") ' PositionInFormula is 6
If PositionInmyFormula > 0 Then
If Worksheet.Function.isumeric(Mid(myFormulaStr, _
PositionInmyFormula + 1, 1)) Then
myCell.Interior.ColorIndex = 8
End If
End If