Required Data in cell
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Application.DisplayAlerts = False
With Sheets("Sheet1")
If .Range("C3") = "" Or .Range("T8") = "" Then
MsgBox "fill in C3 and T8"
Cancel = True
Else
ActiveWorkbook.Save
End If
End With
Application.DisplayAlerts = True
End Sub
This is workbook event code.
Right-click on the Excel Icon left of "File" and "View Code"
Copy/paste into that module.
As far as having no macros warning, without all users setting security to
"Low"(not recommended) you would need to digitally sign the workbook.
Gord Dibben MS Excel MVP
On Wed, 8 Oct 2008 12:22:04 -0700, 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 -
|