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 |
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 |
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? |
All times are GMT +1. The time now is 05:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com