View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Test for numeric constant in a cell

Function Ntest(mycell)
If IsDate(mycell.Value) Then
Ntest = False
ElseIf mycell.HasFormula Then
Ntest = False
Else
Ntest = WorksheetFunction.IsNumber(mycell.Value)
End If
End Function


Note that a value such as 12 typed into a cell formatted as text will return
FALSE with this UDF
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"XP" wrote in message
...
Using Win XP with Office 2007;

I would like to test the contents of a cell to determine if it contains a
numeric constant (i.e. a number, but not a date, or formula).

For example, you would use IsDate to test for a date; is there an
equivalent
for a numeric constant?

1) Could an example function be posted that returns true if the current
cell
contains a numeric constant?

Also, is there a type for a formula?

2) If so, could an example function be posted that returns true if the
current cell contains a formula?

3) A formula that evaluates to a number?

Thanks in advance!