![]() |
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. |
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. |
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. |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 04:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com