TypeName function
Try
MsgBox (LCase(TypeName(ActiveCell.Value)) = "string")
or of course simply change "string" to "String"
For this kind of test I would use
MsgBox VarType(ActiveCell.Value) = vbString
Regards,
Peter T
"ArthurJ" wrote in message
...
Why does the last message box return FALSE when testing a cell for a
string?
I have the same problem checking for numeric values such as Double.
Sub Test()
'The active cell contains the string "ABC"
MsgBox (ActiveCell.Value) 'Displays 'ABC'
MsgBox (TypeName(ActiveCell.Value)) 'Displays 'String'
MsgBox (TypeName(ActiveCell.Value) = "string") 'Displays 'FALSE'
End Sub
|