Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Does Cell contain Formula or Hard Number?

Is there a worksheet function to check whether a cell contains a formula or a
hard number? Thanks in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Does Cell contain Formula or Hard Number?

The worksheetfunction TYPE was designed to do this, but it never worked.
They have not provided a worksheet function that replaces it for this
purpose (that I am aware of).

You can certainly write a UDF that can do it.

--
Regards,
Tom Ogilvy


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

or a
hard number? Thanks in advance.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Does Cell contain Formula or Hard Number?

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.




  #4   Report Post  
Posted to microsoft.public.excel.programming
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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Does Cell contain Formula or Hard Number?

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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Does Cell contain Formula or Hard Number?

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





  #7   Report Post  
Posted to microsoft.public.excel.programming
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Goal Seeking to a Cell instead of a hard number nate Excel Discussion (Misc queries) 1 August 1st 07 04:34 PM
Hard values to convert to number Guilherme Loretti Excel Discussion (Misc queries) 4 May 9th 06 11:14 PM
formula won't work unless column of data is a hard number Ron Excel Worksheet Functions 2 May 17th 05 03:21 PM
Is is possible to add a hard return to a merge cell formula? Nmo11 Excel Discussion (Misc queries) 4 April 5th 05 05:47 PM
Excel formula randomly changes to hard-code number Ned Excel Discussion (Misc queries) 3 February 14th 05 11:31 PM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"