Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code to protect worksheets - amount of worksheets varies
Hello!
I need code that will protect worksheets and the workbook. There are many workbooks involved and depending on the particular workbook, it will have X amount of worksheets in it with various names. Also, I need to hide certain sheets in each workbook - those will always be the same. Any suggestions will be greatly appreciated! Sandy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code to protect worksheets - amount of worksheets varies
heres a macro that i use all the time
this protects all the sheets and the workbook Sub protect() Dim i As Integer ' Loop through all sheets in the workbook. ' change this for the number of sheets For i = 1 To Sheets.Count Sheets(i).protect "PASSWORD", True, True, True 'Range("A1").Select Next i 'protect workbook ActiveWorkbook.protect Structu=True, Windows:=False ActiveWorkbook.protect "PASSWORD", True, False End Sub Sub unprotect() Dim i As Integer ' Loop through all sheets in the workbook. ' this can also be set to a number For i = 1 To Sheets.Count Sheets(i).unprotect "PASSWORD" 'Range("A1").Select Next i ActiveWorkbook.unprotect "PASSWORD" End Sub hope this helps kevin "Sandy" wrote in message ... Hello! I need code that will protect worksheets and the workbook. There are many workbooks involved and depending on the particular workbook, it will have X amount of worksheets in it with various names. Also, I need to hide certain sheets in each workbook - those will always be the same. Any suggestions will be greatly appreciated! Sandy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to protect all the worksheets in a book | New Users to Excel | |||
Maximum amount of worksheets in single file | Excel Discussion (Misc queries) | |||
Copying multiple rows to other worksheets (but amount of rows varies) - How? | Excel Discussion (Misc queries) | |||
Can I password protect worksheets? | Excel Worksheet Functions | |||
How can I protect worksheets in one go? | Excel Worksheet Functions |