View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Does Cell contain Formula or Hard Number?

I think it actually has to have a formula for .hasformula to be true.

This showed false:

Option Explicit
Sub testme()
With ActiveSheet.Range("a1")
.NumberFormat = "@"
.Value = "=33"
Debug.Print .HasFormula
End With
End Sub



Vasant Nanavati wrote:

However, since you asked the question in .programming, you can try:

?Range("A1").HasFormula

Be warned that anything beginning with an = sign will be interpreted as a
formula using this method.

--

Vasant

"Al" wrote in message
...
Is there a worksheet function to check whether a cell contains a formula

or a
hard number? Thanks in advance.



--

Dave Peterson