ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Locking The Cells with Input At The Time of Saving The File (https://www.excelbanter.com/excel-discussion-misc-queries/44510-locking-cells-input-time-saving-file.html)

In Calif

Locking The Cells with Input At The Time of Saving The File
 
Hi,

How can I have any new input into the file to be locked at the time of
saving, so the data can't be changed on the next time the file is opened
again. Thanks for the help!

In Calif



cincode5

In Calif

Create a macro that protects then saves your file. If the file already
exists this should do the trick:

Sub ProtectSave()

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ActiveWorkbook.Close

End Sub

Note: This does not assign a password to unprotect the file. If you do not
wish to exit the workbook at the time of Save, delete the 'Close' statement.

--
Regards...


"In Calif" wrote:

Hi,

How can I have any new input into the file to be locked at the time of
saving, so the data can't be changed on the next time the file is opened
again. Thanks for the help!

In Calif



In Calif

Thanks cincode5, I didn't express my needs well. What I am looking for is to
prevent users from making changes once the file is saved after their input.
I am using this to track vacation, personal day off & sick day dates and
hours taken. The users are given a date col & hrs col to input the date, I
would like the input be protected once the file is saved but the rest of the
empty cells in the col are still unprotected for future input.

Vac Date Vac Hrs.
1/23/2005 8 (Theses entries are protected after saving the file.)
2/23/2005 4
(Blank cells in the range are left
unprotected.)

Thanks again for your time and help!!!

In Calif

"cincode5" wrote:

In Calif

Create a macro that protects then saves your file. If the file already
exists this should do the trick:

Sub ProtectSave()

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ActiveWorkbook.Close

End Sub

Note: This does not assign a password to unprotect the file. If you do not
wish to exit the workbook at the time of Save, delete the 'Close' statement.

--
Regards...


"In Calif" wrote:

Hi,

How can I have any new input into the file to be locked at the time of
saving, so the data can't be changed on the next time the file is opened
again. Thanks for the help!

In Calif




All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com