View Single Post
  #1   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?

You can observe a lot just by watching!

Nobody goes there anymore. It's too crowded.

http://rinkworks.com/said/yogiberra.shtml
(if you want to waste a little time....)




Tom Ogilvy wrote:

Whoops, Deja Vu all over again. Guess I read it out of context. <g

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
I guess I am missing the Point.

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


("Dave Peterson" isn't a cover name for Yogi Berra is it? <g )

I would totally expect it to actually have to have a formula to pass the
.hasformula test. In your example, you put in a text string rather than a
formula, so False would be expected. On the other hand

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

returns true. Perhaps you could elaborate on what your point is.

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
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




--

Dave Peterson