Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
R of Steinke
 
Posts: n/a
Default how can i tell if a cell contains a formula?

How can I tell if a cell contains a formula versus a number or text? (apart
from looking at it). i want to create a conditional format for cells so that
if users enter a formula (or reference to another cell - basically anything
starting with "=" , it appears in a different format.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default how can i tell if a cell contains a formula?

Use a UDF

Function IsFormula(rng As Range)
If rng.Count 1 Then
IsFormula = CVErr(xlErrRef)
Else
IsFormula = rng.HasFormula
End If
End Function


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"R of Steinke" wrote in message
...
How can I tell if a cell contains a formula versus a number or text?

(apart
from looking at it). i want to create a conditional format for cells so

that
if users enter a formula (or reference to another cell - basically

anything
starting with "=" , it appears in a different format.



  #3   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey
 
Posts: n/a
Default how can i tell if a cell contains a formula?

See

http://www.mvps.org/dmcritchie/excel...htm#HasFormula


In article ,
R of Steinke wrote:

How can I tell if a cell contains a formula versus a number or text? (apart
from looking at it). i want to create a conditional format for cells so that
if users enter a formula (or reference to another cell - basically anything
starting with "=" , it appears in a different format.

  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default how can i tell if a cell contains a formula?

I tried using the HasFormula in the link and it doesn't work with my
Excel 2003. No referrence to it in "Help" and the function doesn't
work. I need the same function. Got any suggestions? ed

  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default how can i tell if a cell contains a formula?

This user defined function is not built into excel. It's a function that is
created by the user.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Function HasFormula(cell)
HasFormula = cell.HasFormula
End Function

(From David McRitchie's site)

Now go back to excel.
Into a test cell and type:
=hasformula(a1)

wrote:

I tried using the HasFormula in the link and it doesn't work with my
Excel 2003. No referrence to it in "Help" and the function doesn't
work. I need the same function. Got any suggestions? ed


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default how can i tell if a cell contains a formula?

Fantastic!!! Thank you. I used it to conditional format a cell and
works perfectly. Now to learn of the other user defined functions
available in the link you supplied. ed

  #7   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default how can i tell if a cell contains a formula?

And one of the neat things about these UDFs is that you can make your own--as
complex as you need.



wrote:

Fantastic!!! Thank you. I used it to conditional format a cell and
works perfectly. Now to learn of the other user defined functions
available in the link you supplied. ed


--

Dave Peterson
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
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
How do I set a cell value based on a formula in another cell? dingy101 Excel Discussion (Misc queries) 1 November 21st 05 08:51 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Creating a check mark box MarthaSue Setting up and Configuration of Excel 18 April 28th 05 12:31 AM
looking for a formula Amanda Excel Worksheet Functions 5 January 5th 05 07:37 AM


All times are GMT +1. The time now is 02:17 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"