Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XL2000: Check Macro for missing cell value

Status
Not open for further replies.

locutis

Programmer
Nov 3, 2006
53
US
Hello Excel gurus,
I have a lookup sheet with a particular value that is populated from a database via MS Query. This value is used by a display sheet. Works fine, but if the value is empty, I would like to be able to alert the user with a msgbox, then return false. I've been looking at a few things out there, here is one I found and tried to make work, but can't quite get it:

Public gOldN1 As Variant

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("N1")) Is Nothing Then
MsgBox "A Billing Contact is Required
End If
End If
End Sub

When the workbook starts:

Private Sub Workbook_Open()
gOldN1 = Sheets("Sheet2").Range("N1").Value
End Sub

Am I on the right track, or is there an easier way to do what I'm trying to do? I also want to return false and not let the sheet load.

Thanks in advance,
Jean Luc
 


Please post code questions in


VBA Visual Basic for Applications (Microsoft) forum707.

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top