ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   help with protection of sheets (https://www.excelbanter.com/excel-discussion-misc-queries/195256-help-protection-sheets.html)

des-sa[_2_]

help with protection of sheets
 
please help
i have a petty cash workbook file where there is a new sheet generated via a
macro for each day. the new sheet is generated by copying today's sheet and
clearing the contents for the new day. the date is entered into this new
sheet in cell E1, which then automatically becomes the sheet name of the new
one. is it possible to create vb code to automatically lock yesterday's
sheet for editing and hide it, so that at any point the financial person sees
only today's sheet - if so, could someone help with the code

Jim Thomlinson

help with protection of sheets
 
Post your existing code...
--
HTH...

Jim Thomlinson


"des-sa" wrote:

please help
i have a petty cash workbook file where there is a new sheet generated via a
macro for each day. the new sheet is generated by copying today's sheet and
clearing the contents for the new day. the date is entered into this new
sheet in cell E1, which then automatically becomes the sheet name of the new
one. is it possible to create vb code to automatically lock yesterday's
sheet for editing and hide it, so that at any point the financial person sees
only today's sheet - if so, could someone help with the code


StumpedAgain

help with protection of sheets
 
The following macro will protect the sheet after the sheet you have currently
selected and then hide it. Depending on where you put this in your current
macro, you may want to take out the ".Next" in the macro. Also, if you want
a password, you can add "Password:=abc123" after "Scenarios:=True. Hope this
helps!

Sub ProtectAndHide()

ActiveSheet.Next.Protect Scenarios:=True
ActiveSheet.Next.Visible = False

End Sub
--
-SA


"des-sa" wrote:

please help
i have a petty cash workbook file where there is a new sheet generated via a
macro for each day. the new sheet is generated by copying today's sheet and
clearing the contents for the new day. the date is entered into this new
sheet in cell E1, which then automatically becomes the sheet name of the new
one. is it possible to create vb code to automatically lock yesterday's
sheet for editing and hide it, so that at any point the financial person sees
only today's sheet - if so, could someone help with the code


des-sa[_2_]

help with protection of sheets
 
Sub locksheet()
'
' locksheet Macro
' Macro recorded 2008/07/17 by DISRI
'
' Keyboard Shortcut: Ctrl+l
'
Sheets("MASTER").Select
Sheets("MASTER").Copy Befo=Sheets(3)
Range("E1").Select
ActiveCell.FormulaR1C1 = "ENTER DATE"
Range("E2").Select
Sheets("MASTER").Select
Range("M6").Select
Selection.Copy
Sheets("ENTER DATE").Select
Range("M3").Select
ActiveSheet.Paste
Range("B3:K17").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("B21:M35").Select
Selection.ClearContents
Range("E1").Select
Sheets("MASTER").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
Sheets("ENTER DATE").Select
Range("E1").Select
End Sub


"Jim Thomlinson" wrote:

Post your existing code...
--
HTH...

Jim Thomlinson


"des-sa" wrote:

please help
i have a petty cash workbook file where there is a new sheet generated via a
macro for each day. the new sheet is generated by copying today's sheet and
clearing the contents for the new day. the date is entered into this new
sheet in cell E1, which then automatically becomes the sheet name of the new
one. is it possible to create vb code to automatically lock yesterday's
sheet for editing and hide it, so that at any point the financial person sees
only today's sheet - if so, could someone help with the code



All times are GMT +1. The time now is 06:49 AM.

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