ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validating a Formula (https://www.excelbanter.com/excel-programming/277993-validating-formula.html)

Cath[_2_]

Validating a Formula
 
I am trying to validate a cell that has a formula in it.

i.e. c132=sumc1:c131

i need to have an error message appear in the sum of c132
is greater than 65. i can get the validation to work on a
cell that has a number entered directly but cannot get it
to work on a cell that has a formula.


J.E. McGimpsey

Validating a Formula
 
One way:

Put this in the worksheet code module


Private Sub Worksheet_Calculate()
If Range("C132").Value 65 Then MsgBox "C132 65"
End Sub

You might also consider using Conditional Formatting to change the
cell color instead.

In article ,
"Cath" wrote:

I am trying to validate a cell that has a formula in it.

i.e. c132=sumc1:c131

i need to have an error message appear in the sum of c132
is greater than 65. i can get the validation to work on a
cell that has a number entered directly but cannot get it
to work on a cell that has a formula.


Tom Ogilvy

Validating a Formula
 
Just to add, Data Validation is only applied when you make a manual change
to a cell.

--
Regards,
Tom Ogilvy

"J.E. McGimpsey" wrote in message
...
One way:

Put this in the worksheet code module


Private Sub Worksheet_Calculate()
If Range("C132").Value 65 Then MsgBox "C132 65"
End Sub

You might also consider using Conditional Formatting to change the
cell color instead.

In article ,
"Cath" wrote:

I am trying to validate a cell that has a formula in it.

i.e. c132=sumc1:c131

i need to have an error message appear in the sum of c132
is greater than 65. i can get the validation to work on a
cell that has a number entered directly but cannot get it
to work on a cell that has a formula.





All times are GMT +1. The time now is 07:27 AM.

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