You need to write a very small macro. Here is the VBA help instructions.
the code must be placed in the Thisworkbook object in VBA. In the Tools Menu
- Macro - visual Basic editor. the left window is the Project Window.
Double click Thisworkbook.
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, _
ByVal SaveAsUI As Boolean, Cancel as Boolean)
sheets("sheet1").range("A3") = sheets("sheet1").range("A3") + 1
End Sub
VBA Help
---------------------------------------------------------------------------------------
WorkbookBeforeSave Event
See AlsoApplies ToExampleSpecificsOccurs before any open workbook is saved.
Private Sub object_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUi
As Boolean, ByVal Cancel As Boolean)
object An object of type Application declared with events in a class
module. For more information, see Using Events with the Application Object.
Wb The workbook.
SaveAsUi True if the Save As dialog box will be displayed.
Cancel False when the event occurs. If the event procedure sets this
argument to True, the workbook isn't saved when the procedure is finished.
Example
This example prompts the user for a yes or no response before saving any
workbook.
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, _
ByVal SaveAsUI As Boolean, Cancel as Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
End Sub