Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default protecting sheets

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default protecting sheets

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default protecting sheets

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default protecting sheets

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting Sheets Esradekan[_2_] Excel Worksheet Functions 2 May 30th 09 11:52 PM
Protecting Sheets with VBA Helen Excel Programming 1 January 21st 05 03:56 PM
Protecting sheets TV Excel Discussion (Misc queries) 1 November 29th 04 09:27 PM
Protecting buttons with VB code rather than protecting sheets/books? StargateFanFromWork Excel Programming 2 July 16th 04 04:03 PM
Protecting sheets LC[_5_] Excel Programming 1 February 19th 04 05:14 AM


All times are GMT +1. The time now is 04:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"