ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identifying formulas using Validation rule (https://www.excelbanter.com/excel-programming/377927-identifying-formulas-using-validation-rule.html)

Bob

Identifying formulas using Validation rule
 
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


JLGWhiz

Identifying formulas using Validation rule
 
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?

"Bob" wrote:

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


JLGWhiz

Identifying formulas using Validation rule
 
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
FormatCellsPatterns facility.

"Bob" wrote:

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



All times are GMT +1. The time now is 07:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com