User Defined Message box

pedro915

New Member
Joined
Apr 20, 2011
Messages
3
I need help with with creating 2 message boxs to show only when the results entered by the user in cell B2 is higher or lower then number in cells D8 and D9.

the scenario is as follows:

if the user enters for example 8 in cell B2 and Cell D8 contains 6 then the message box should appear and show the message "ur result is 2" and the same if the number entered in cell B2 is lower then the number in cell D9 then a message box should appear sayin (your result is XX).

I don't know whats the best practice to do it and how to achieve it, I would appreciate your help. im using excel 2007 btw
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi,

Welcome to the board.

Try this:

Alt + F11 -> Double click on your sheet in the project window on the left -> Paste the below into the code window:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("B2")) Is Nothing Then
        If Target.Value > Target.Offset(6, 2).Value Then
            MsgBox "Your value is: " & Target.Value - Target.Offset(6, 2).Value
        ElseIf Target.Value < Target.Offset(7, 2).Value Then
            MsgBox "Your value is: " & Target.Value - Target.Offset(7, 2).Value
        End If
    End If
End Sub

Nothing happens if they are equal using the above, is this correct?
 
Upvote 0
Thank you James
It is correct however I entered the code and nothing happened.

I just wanna add that Cells D8 and D9 also changes by the user input it shows the maximum and minimum of user input range after a calculation.
so if the user enters 8 and the maximum for his score is calculated 6 in cell d8 then a massage box should appear saying your score is higher it should be 2 scored lower and so on if his score is below the calculated minnimum.
I also wanna add that all cells are numeric
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top