Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Identifying formulas using a 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

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 58
Default Identifying formulas using a Validation rule

Personally, I would create a style that has the "Locked" flag selected
(as it is by default). Highlight the entire sheet and unlock all the
cells, then apply the style to your formula cells only. Protect the
sheet and you're done.

Is there any special reason why you're trying to protect your formula
via a validation rule and not the built in protection methods?

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Identifying formulas using a Validation rule

Ken,
The reason I am not using Excel's protection capabilities is because the
workbook is "shared" and uses macros. Once shared, you cannot
protect/unprotect a workbook. Hence, the reason I need to use Validation
rules.
Bob


"Ken Puls" wrote:

Personally, I would create a style that has the "Locked" flag selected
(as it is by default). Highlight the entire sheet and unlock all the
cells, then apply the style to your formula cells only. Protect the
sheet and you're done.

Is there any special reason why you're trying to protect your formula
via a validation rule and not the built in protection methods?

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

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


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 58
Default Identifying formulas using a Validation rule

To my knowledge it is not possible to use a UDF as a Data Validation
criteria.

Based on that, the options that I can see are to either unshare the
workbook, which you need to do to apply the validation rules anyway, and
apply the method I outlined before.

Honestly, I hope someone comes along and proves me wrong here, or
provides an alternate route.

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

Bob wrote:
Ken,
The reason I am not using Excel's protection capabilities is because the
workbook is "shared" and uses macros. Once shared, you cannot
protect/unprotect a workbook. Hence, the reason I need to use Validation
rules.
Bob


"Ken Puls" wrote:

Personally, I would create a style that has the "Locked" flag selected
(as it is by default). Highlight the entire sheet and unlock all the
cells, then apply the style to your formula cells only. Protect the
sheet and you're done.

Is there any special reason why you're trying to protect your formula
via a validation rule and not the built in protection methods?

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

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

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Identifying formulas using a Validation rule

I'd use a UDF like this:

Option Explicit
Function IsFormula(rng As Range) As Boolean
IsFormula = CBool(rng.Cells(1).HasFormula)
End Function


Then I could put a formula in another cell (say B1)
=isformula(a1)
(and hide that column???)

And use that cell for data|validation
Custom
=B1=TRUE

But be aware that
=1234
is a formula.


Bob wrote:

Ken,
The reason I am not using Excel's protection capabilities is because the
workbook is "shared" and uses macros. Once shared, you cannot
protect/unprotect a workbook. Hence, the reason I need to use Validation
rules.
Bob

"Ken Puls" wrote:

Personally, I would create a style that has the "Locked" flag selected
(as it is by default). Highlight the entire sheet and unlock all the
cells, then apply the style to your formula cells only. Protect the
sheet and you're done.

Is there any special reason why you're trying to protect your formula
via a validation rule and not the built in protection methods?

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

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



--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Identifying formulas using a Validation rule

Dave,
Interesting solution. Given that my workbook contains over 130 columns, and
over 550 rows of data, I'm reluctant to add the 6 additional hidden columns
needed to do the job. The file size is huge as it is!
Thanks all the same. I will definitely keep your solution in mind for
future workbooks.
Bob

"Dave Peterson" wrote:

I'd use a UDF like this:

Option Explicit
Function IsFormula(rng As Range) As Boolean
IsFormula = CBool(rng.Cells(1).HasFormula)
End Function


Then I could put a formula in another cell (say B1)
=isformula(a1)
(and hide that column???)

And use that cell for data|validation
Custom
=B1=TRUE

But be aware that
=1234
is a formula.


Bob wrote:

Ken,
The reason I am not using Excel's protection capabilities is because the
workbook is "shared" and uses macros. Once shared, you cannot
protect/unprotect a workbook. Hence, the reason I need to use Validation
rules.
Bob

"Ken Puls" wrote:

Personally, I would create a style that has the "Locked" flag selected
(as it is by default). Highlight the entire sheet and unlock all the
cells, then apply the style to your formula cells only. Protect the
sheet and you're done.

Is there any special reason why you're trying to protect your formula
via a validation rule and not the built in protection methods?

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

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



--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Identifying formulas using a Validation rule

Ken,
Thanks for the info. I was really hoping that I could use a UDF as a Data
Validation criteria. Thanks again for all your help.
Bob


"Ken Puls" wrote:

To my knowledge it is not possible to use a UDF as a Data Validation
criteria.

Based on that, the options that I can see are to either unshare the
workbook, which you need to do to apply the validation rules anyway, and
apply the method I outlined before.

Honestly, I hope someone comes along and proves me wrong here, or
provides an alternate route.

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

Bob wrote:
Ken,
The reason I am not using Excel's protection capabilities is because the
workbook is "shared" and uses macros. Once shared, you cannot
protect/unprotect a workbook. Hence, the reason I need to use Validation
rules.
Bob


"Ken Puls" wrote:

Personally, I would create a style that has the "Locked" flag selected
(as it is by default). Highlight the entire sheet and unlock all the
cells, then apply the style to your formula cells only. Protect the
sheet and you're done.

Is there any special reason why you're trying to protect your formula
via a validation rule and not the built in protection methods?

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

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


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 58
Default Identifying formulas using a Validation rule

Happy to, Bob, only I wish I could have given better news.

I agree that it would be a very nice feature to have. I haven't tested
to see if you can do that in Excel 2007 (i doubt it though), but maybe
MS will develop it in the next release after? Late would be better than
never, after all. :)

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

Bob wrote:
Ken,
Thanks for the info. I was really hoping that I could use a UDF as a Data
Validation criteria. Thanks again for all your help.
Bob


"Ken Puls" wrote:

To my knowledge it is not possible to use a UDF as a Data Validation
criteria.

Based on that, the options that I can see are to either unshare the
workbook, which you need to do to apply the validation rules anyway, and
apply the method I outlined before.

Honestly, I hope someone comes along and proves me wrong here, or
provides an alternate route.

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

Bob wrote:
Ken,
The reason I am not using Excel's protection capabilities is because the
workbook is "shared" and uses macros. Once shared, you cannot
protect/unprotect a workbook. Hence, the reason I need to use Validation
rules.
Bob


"Ken Puls" wrote:

Personally, I would create a style that has the "Locked" flag selected
(as it is by default). Highlight the entire sheet and unlock all the
cells, then apply the style to your formula cells only. Protect the
sheet and you're done.

Is there any special reason why you're trying to protect your formula
via a validation rule and not the built in protection methods?

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

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

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default Identifying formulas using a Validation rule

Try this:

I don't know if this will work on a shared file but it works on non-shared
files.

Create this named formula:

Name: IsFormula
Refers to:

=GET.CELL(48,INDIRECT("RC",FALSE))

Set the validation:
Select the cells you want to validate.
Allow: Custom
Formula: =IsFormula
Uncheck: Ignore blank

I can't figure out why, but it doesn't work unless Ignore blank is
unchecked.

Biff

"Bob" wrote in message
...
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



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
Data Validation Error Dileep Chandran Excel Worksheet Functions 7 November 8th 06 12:22 PM
Please help with Statistics Formulas in Excel Fonz Excel Discussion (Misc queries) 10 April 9th 06 03:22 PM
Formulas not recognizing new data malakingaso Excel Discussion (Misc queries) 1 February 8th 06 07:27 PM
validation rule andrewm Excel Worksheet Functions 7 June 23rd 05 06:45 AM
Data Validation Window? Ken Excel Discussion (Misc queries) 1 January 11th 05 10:48 PM


All times are GMT +1. The time now is 09:21 PM.

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"