MrExcel Publishing
Your One Stop for Excel Tips & Solutions

MessageBox


Posted by Laura on July 22, 2001 8:56 AM

Hi,Can someone show me how to have a message Box
activate based on a cell entry. e.g. After i enter a
number in cell M11 it performs a calculation in cell
S11 and cell S17. If cell S17 is less than S11 i would
like a message box to appear.
Thanks in advance
Laura T.


Posted by Dax on July 22, 2001 10:09 AM

Laura,

If you right click the worksheet tab and select View Code you'll be presented with the worksheet code module. This code will check the values of S17 and S11 and will display a message box if the value of S17 is lower than that of S11.

Private Sub Worksheet_Change(ByVal Target As Range)
If ([S17] < [S11]) And Not IsEmpty([S17]) And Not IsEmpty([S11]) Then
MsgBox "S17 is lower than S11. Please change cell M11", vbExclamation + vbOKOnly, "Error!"
End If
End Sub

HTH,
Dax.

Posted by Laura on July 22, 2001 10:25 AM

Thanks Dax