Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 0 down vote accepted

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
share|improve this answer

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).

share|improve this answer
What if there are two variables? – Sux2Lose Nov 22 '10 at 21:56
My formula depends upon four or five cells – Javed Akram Nov 23 '10 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 '10 at 13:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.