Identifying formulas using Validation rule


G

Guest

A member of this forum provided the following UDF to display a formula within
a cell:

Function GetFormula(Cell As Range) As String
GetFormula = Cell.Formula
End Function

I tried creating the following “custom†Validation rule for cell A1 (which
happens to contain a formula):

=LEFT(GetFormula(A1),1)="="

but it is not working correctly (I get a “Named range cannot be found†error
message).

I want to ensure that someone doesn't inadvertently over-write a cell
containing a formula.

Can anyone show me how to do this using a Validation rule? I am aware of a
solution using Conditional Formatting, but I really need to use a Validation
rule.

Any help would be greatly appreciated.

Thanks,
Bob
 
Ad

Advertisements

G

Guest

If you only enter =LEFT(GetFormula(a1),1) the it gives you "=" so the
function works. What were you looking for as a result of your formula. True?
 
Ad

Advertisements

G

Guest

Sorry Bob, I did not read your entire message before replying. There are a
couple of options to reduce the probability of overwriting cells with
formulas. One is to portect the sheet and unlock only the cells that are
allowed to have data entered. You can consult the help files for this method.

The other simpler but less secure method is to add background colors to
those cells that contain formulas. You can do that through the
Format>Cells>Patterns facility.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top