Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I want to protect all my sheets but I have 255 in the workbook Is there
any way I can protect them all at once or do I have to do them one at a time.I tried protecting the workbook but I could still change cells I wanted to protect. thanks in avance, Wildauk. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thy this:
Sub protectsheets() For Each sht In Worksheets sht.Protect Next sht End Sub Dan "wildauk" wrote: Hi, I want to protect all my sheets but I have 255 in the workbook Is there any way I can protect them all at once or do I have to do them one at a time.I tried protecting the workbook but I could still change cells I wanted to protect. thanks in avance, Wildauk. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Actually, I forgot a "thisworkbook" reference to avoid protecting all
worksheets... Sub protectsheets() For Each sht In ThisWorkbook.Worksheets sht.Protect Next sht End Sub Note: you can add a lot of specifics to the protect method like passwords, etc. expression.Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly) See the VBA help for more info. Dan "Dan Hatola" wrote: Thy this: Sub protectsheets() For Each sht In Worksheets sht.Protect Next sht End Sub Dan "wildauk" wrote: Hi, I want to protect all my sheets but I have 255 in the workbook Is there any way I can protect them all at once or do I have to do them one at a time.I tried protecting the workbook but I could still change cells I wanted to protect. thanks in avance, Wildauk. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
ThisWorkbook is a parent of sheets in , if you want to run it from other Workbook as AddIns, just change ThisWorkbook to ActiveWorkbook you want to protect the whole sheets in it. thanks, Hhalim Dan Hatola menuliskan: Actually, I forgot a "thisworkbook" reference to avoid protecting all worksheets... Sub protectsheets() For Each sht In ThisWorkbook.Worksheets sht.Protect Next sht End Sub Note: you can add a lot of specifics to the protect method like passwords, etc. expression.Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly) See the VBA help for more info. Dan "Dan Hatola" wrote: Thy this: Sub protectsheets() For Each sht In Worksheets sht.Protect Next sht End Sub Dan "wildauk" wrote: Hi, I want to protect all my sheets but I have 255 in the workbook Is there any way I can protect them all at once or do I have to do them one at a time.I tried protecting the workbook but I could still change cells I wanted to protect. thanks in avance, Wildauk. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protecting Sheets | Excel Worksheet Functions | |||
Protecting Sheets with VBA | Excel Programming | |||
Protecting sheets | Excel Discussion (Misc queries) | |||
Protecting buttons with VB code rather than protecting sheets/books? | Excel Programming | |||
Protecting sheets | Excel Programming |