Hi,
I probaly meant before save.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not IsDate(Sheets("Sheet1").Range("A1")) _
Or IsEmpty(Sheets("Sheet1").Range("A2")) Then
MsgBox "Some sort of dire warning"
Cancel = True
End If
End Sub
Mike
"Mike H" wrote:
Hi,
Alt+F11 to open VB editor. Double click 'This workbook' and paste this in on
the right . Change ranges and sheet to suit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not IsDate(Sheets("Sheet1").Range("A1")) _
Or IsEmpty(Sheets("Sheet1").Range("A2")) Then
MsgBox "Some sort of dire warning"
Cancel = True
End If
End Sub
Mike
"cmac" wrote:
Is there a way to require that a particular cell be populated prior to saving
an Excel file (one cell is text and one is a date field)? We are using a
spreadsheet to collect data from users that is later used to feed an Access
database and need to be sure that the source file has these two key cells
populated.
Thank you -