#1   Report Post  
Alan
 
Posts: n/a
Default Formula or not?

Hi,
Is there a formula to establish whether a cell contains a value or a
formula? What I mean is say A1 contained =10+20 so it shows 30 and it
contains a formula. If I then paste special values it still shows 30 but
there is no formula as there would not be in an empty cell. What I'm looking
for is a formula in another cell which will give a TRUE or FALSE if there is
a formula in A1 or not.
TIA,
Regards,
Alan.


  #2   Report Post  
Niek Otten
 
Posts: n/a
Default

Hi Alan,

A simple User define Function (UDF) will do.

Function CellHasFormula(a As Range) As Boolean
CellHasFormula = a.HasFormula
End Function

Open the VB editor (ALT+F11)
From the menu: InsertModule

Paste the above function in the module

Return to the worksheet. You can now use CellHasFormula(A1) as if it were a
built-in function.

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Alan" wrote in message
...
Hi,
Is there a formula to establish whether a cell contains a value or a
formula? What I mean is say A1 contained =10+20 so it shows 30 and it
contains a formula. If I then paste special values it still shows 30 but
there is no formula as there would not be in an empty cell. What I'm
looking for is a formula in another cell which will give a TRUE or FALSE
if there is a formula in A1 or not.
TIA,
Regards,
Alan.



  #3   Report Post  
Alan
 
Posts: n/a
Default

Hi Niek,
That is perfect, Thank You!
Once again my thanks to you and the experts in these newsgroups,
Regards,
Alan.

"Niek Otten" wrote in message
...
Hi Alan,

A simple User define Function (UDF) will do.

Function CellHasFormula(a As Range) As Boolean
CellHasFormula = a.HasFormula
End Function

Open the VB editor (ALT+F11)
From the menu: InsertModule

Paste the above function in the module

Return to the worksheet. You can now use CellHasFormula(A1) as if it were
a built-in function.

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Alan" wrote in message
...
Hi,
Is there a formula to establish whether a cell contains a value or a
formula? What I mean is say A1 contained =10+20 so it shows 30 and it
contains a formula. If I then paste special values it still shows 30 but
there is no formula as there would not be in an empty cell. What I'm
looking for is a formula in another cell which will give a TRUE or FALSE
if there is a formula in A1 or not.
TIA,
Regards,
Alan.





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
Match / Vlookup within an Array formula Hari Prasadh Excel Discussion (Misc queries) 3 February 3rd 05 04:37 PM
revert formula insertion to old method Don't be a pain in the ass Setting up and Configuration of Excel 0 January 24th 05 01:49 PM
Relative Indirect Formula Referencing? Damian Excel Worksheet Functions 1 January 7th 05 04:16 AM
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM
Cell doesn't show formula result - it shows formula (CTRL + ' doe. o0o0o0o Excel Worksheet Functions 6 November 19th 04 03:13 PM


All times are GMT +1. The time now is 08:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"