View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default TypeName function

Hi,

Try this. Note a few less parenthesis

Sub Test()
'The active cell contains the string "ABC"
MsgBox ActiveCell.Value 'Displays 'ABC'
MsgBox TypeName(ActiveCell.Value) 'Displays 'String'
MsgBox TypeName(ActiveCell.Value) = TypeName("String") 'Displays 'FALSE'
End Sub

Mike

"ArthurJ" wrote:

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