Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Goal Seeking to a Cell instead of a hard number | Excel Discussion (Misc queries) | |||
Hard values to convert to number | Excel Discussion (Misc queries) | |||
formula won't work unless column of data is a hard number | Excel Worksheet Functions | |||
Is is possible to add a hard return to a merge cell formula? | Excel Discussion (Misc queries) | |||
Excel formula randomly changes to hard-code number | Excel Discussion (Misc queries) |