Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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
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
In 2007 I am having difficulty distinguishing highlighted areas Bear Black Excel Discussion (Misc queries) 2 November 20th 08 09:31 AM
Distinguishing between Cells with Formula vs Cells with Text/Value bstobart Excel Worksheet Functions 3 October 6th 08 06:45 PM
distinguishing formula cells [email protected] Excel Discussion (Misc queries) 6 June 12th 06 01:10 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


All times are GMT +1. The time now is 10:41 AM.

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"