MessageBox???


Posted by Krijg Tieten on September 21, 2001 5:47 AM

Does anybody knows how to let a messagebox appear when cell D11 is a value and cell G11 is empty? I've got a code but it doesn't work! Anybody who knows what's wrong with it?

The code I have:

Sub Change()
If Not Worksheets("Sh1").Range("D11") Is Nothing And Worksheets("Sh1").Range("G11") Is Nothing Then
Display = MsgBox("Put something in G11", 48, "ERROR")
Worksheets("Sh1").Range("G11").Select
Exit Sub
Else
End If

I hope someone can help me out?



Posted by Barrie Davidson on September 21, 2001 6:04 AM

Krijg, try putting this code in your worksheet's code (access this by right clicking on the worksheet tab and selecting "view code").

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range("D11") <> "" And Range("G11") = "" Then
MsgBox prompt:="Put something in G11", Buttons:=vbExclamation, Title:="Error"
Range("G11").Select
End If
End Sub


Regards,
BarrieBarrie Davidson