Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Distinguishing cell formula from value.
How can I use VBA code to examine the content of a cell so as to
determine whether it contains a hard value, such as the number 12, rather than a formula that yields the value 12? It suspect that there should be a way to search the cell content for an equal sign (=) in the alphanumeric character string using *=* where * substitutes for any group of characters. Alternatively, perhaps there is something line the fuction cell("type", A1) where it returns a character string depending on whether the cell in location A1 is blank, contains a label, or returns a value. The cell("type") function does not distinguish between a hard value and a formula that yields a value. Suggestions?? Thanks Michael |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Distinguishing cell formula from value.
Hi Michael,
You could use something like: If Sheet1.Range("A1").HasFormula Then ''' Your code here. End If -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses * "buczacz" wrote in message ... How can I use VBA code to examine the content of a cell so as to determine whether it contains a hard value, such as the number 12, rather than a formula that yields the value 12? It suspect that there should be a way to search the cell content for an equal sign (=) in the alphanumeric character string using *=* where * substitutes for any group of characters. Alternatively, perhaps there is something line the fuction cell("type", A1) where it returns a character string depending on whether the cell in location A1 is blank, contains a label, or returns a value. The cell("type") function does not distinguish between a hard value and a formula that yields a value. Suggestions?? Thanks Michael |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Distinguishing cell formula from value.
Works great... Thanks ... !!!!!
Researching the .HasFormula function also lead me to the web pages of David McRitchie that have a wealth of additional information. Rob Bovey wrote: Hi Michael, You could use something like: If Sheet1.Range("A1").HasFormula Then ''' Your code here. End If Original question: How can I use VBA code to examine the content of a cell so as to determine whether it contains a hard value, such as the number 12, rather than a formula that yields the value 12? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
In 2007 I am having difficulty distinguishing highlighted areas | Excel Discussion (Misc queries) | |||
Distinguishing between Cells with Formula vs Cells with Text/Value | Excel Worksheet Functions | |||
distinguishing formula cells | Excel Discussion (Misc queries) | |||
Cell Formula reference to cell Based On third Cell Content | Excel Discussion (Misc queries) | |||
Question: Cell formula or macro to write result of one cell to another cell | Excel Programming |