How to auto save

Status
Not open for further replies.

mhemat

New Member
Joined
Apr 14, 2011
Messages
30
I have blank template (BT) that everytime opens up a new ID number is generated. How can i insure that before any entry is performed on this BT, the file is automatically saved the ID number so, the next time the BT opens up generates a ned ID number or a dialog box alert the user to save befor any new entry?

Thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi,

I use this code when a Workbook is opened to increase an ID Number in cell D9.

Code:
Private Sub Workbook_Open()
Application.DisplayAlerts = False
Dim S As String
If Not MsgBox("  Do you wish to continue? ", vbYesNo + vbQuestion, "    mhemat says....") = vbYes Then
        bolOpening = True
        ThisWorkbook.Close False
    End If
Sheets("YOUR SHEET NAME HERE").Select
ActiveSheet.Unprotect ("Password1")
Sheets("YOUR SHEET NAME HERE").Range("D9").Value = Sheets("YOUR SHEET NAME HERE").Range("D9").Value + 1
ActiveSheet.Protect ("Password1")
ActiveWorkbook.Save

Application.DisplayAlerts = True
End Sub

When the workbook is opened, a message box will appear asking the user if they want to continue, if they click Yes then the value in D9 will increase by 1 and the workbook will be saved, if they no, then the workbook will close.
I hope that works for you.
I don't write or understand VBA code , so I cannot help you further, sorry.

Ak
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top