0

I have validated a cell by data validation.
Now, it can hold only values between 0 to 100. if user enters value out of range i.e. below 0 or above 100 a message box appears to inform that value must be between 0 to 100.

I have also validated another cell with same range of values as above but it depends on other cells(i.e. it containing formula) but if the result is out of range i.e. below 0 or above 100 message box does not appear.

I want to display a message box to inform user check your values. How can I do this?

2 Answers 2

0

Not sure how to do it outside of VBA. Here is some VBA to add to your sheet to get this functionality:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("TestCell") > 100 Then
    MsgBox "Check your inputs."
End If
End Sub
0

Put the data validation rule in the cell which your formula depends on. If, for example, you have =2*A1 in B1 and you have set data validation for B1 (for example between 0 and 100), set validation for A1 instead (for example between 0 and 50).

3
  • What if there are two variables?
    – Sux2Lose
    Nov 22, 2010 at 21:56
  • My formula depends upon four or five cells Nov 23, 2010 at 1:48
  • Let say for example that your formula is in A1. Then set the conditional formatting custom rule (A1<=100)*(A1>=0) in ALL the cells your formula depends on. If you do not want or you cannot, write a VBA subroutine as suggested by Sux2Lose.
    – Toc
    Nov 23, 2010 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .