Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Protecting Multiple Worksheets

Hi
I need to protect multiple worksheets to lock cells. Only
way I can see to do this is to go into individual sheets
and do this. The 'protect sheet' option is greyed out
when multiple sheets are open.
Is it therefore possible to run a macro to protect /
unprotect worksheets with a password?
Thanking you in advance. Sam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Protecting Multiple Worksheets

Try this Sam

Sub prot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ron"
Next sh
Application.ScreenUpdating = True
End Sub

Sub unprot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Unprotect "ron"
Next sh
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in message ...
Hi
I need to protect multiple worksheets to lock cells. Only
way I can see to do this is to go into individual sheets
and do this. The 'protect sheet' option is greyed out
when multiple sheets are open.
Is it therefore possible to run a macro to protect /
unprotect worksheets with a password?
Thanking you in advance. Sam



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Protecting Multiple Worksheets

Ron!

Thank you - this worked perfectly - you little star!
Quick question - does sh.protect "ron" set the password?
Thanks
Sam
-----Original Message-----
Try this Sam

Sub prot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ron"
Next sh
Application.ScreenUpdating = True
End Sub

Sub unprot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Unprotect "ron"
Next sh
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in

message ...
Hi
I need to protect multiple worksheets to lock cells.

Only
way I can see to do this is to go into individual sheets
and do this. The 'protect sheet' option is greyed out
when multiple sheets are open.
Is it therefore possible to run a macro to protect /
unprotect worksheets with a password?
Thanking you in advance. Sam



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Protecting Multiple Worksheets

Ron
Me again.
If the sh.protect "ron" is the password - is it possible
to make it look at a cell in the spreadsheet - otherwise
the password just runs and doesn't need to be entered. It
would be good to have the person enter the password (once)
manually to make it more protected.
something like - sh.Unprotect = sh.name cell ##

Does that make sense?

Thanks again - Sam
-----Original Message-----
Try this Sam

Sub prot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ron"
Next sh
Application.ScreenUpdating = True
End Sub

Sub unprot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Unprotect "ron"
Next sh
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in

message ...
Hi
I need to protect multiple worksheets to lock cells.

Only
way I can see to do this is to go into individual sheets
and do this. The 'protect sheet' option is greyed out
when multiple sheets are open.
Is it therefore possible to run a macro to protect /
unprotect worksheets with a password?
Thanking you in advance. Sam



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Protecting Multiple Worksheets

You can use this

sh.Protect ThisWorkbook.Sheets("Sheet1").Range("A1").Value


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in message ...
Ron
Me again.
If the sh.protect "ron" is the password - is it possible
to make it look at a cell in the spreadsheet - otherwise
the password just runs and doesn't need to be entered. It
would be good to have the person enter the password (once)
manually to make it more protected.
something like - sh.Unprotect = sh.name cell ##

Does that make sense?

Thanks again - Sam
-----Original Message-----
Try this Sam

Sub prot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ron"
Next sh
Application.ScreenUpdating = True
End Sub

Sub unprot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Unprotect "ron"
Next sh
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in

message ...
Hi
I need to protect multiple worksheets to lock cells.

Only
way I can see to do this is to go into individual sheets
and do this. The 'protect sheet' option is greyed out
when multiple sheets are open.
Is it therefore possible to run a macro to protect /
unprotect worksheets with a password?
Thanking you in advance. Sam



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Protecting Multiple Worksheets

does sh.protect "ron" set the password

Yes


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



wrote in message ...
Ron!

Thank you - this worked perfectly - you little star!
Quick question - does sh.protect "ron" set the password?
Thanks
Sam
-----Original Message-----
Try this Sam

Sub prot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ron"
Next sh
Application.ScreenUpdating = True
End Sub

Sub unprot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Unprotect "ron"
Next sh
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in

message ...
Hi
I need to protect multiple worksheets to lock cells.

Only
way I can see to do this is to go into individual sheets
and do this. The 'protect sheet' option is greyed out
when multiple sheets are open.
Is it therefore possible to run a macro to protect /
unprotect worksheets with a password?
Thanking you in advance. Sam



.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Protecting Multiple Worksheets

Ron - this is perfect! Thank you so much - you are an
absolute star. I appreciate your help immensly.
Sam
-----Original Message-----
You can use this

sh.Protect ThisWorkbook.Sheets("Sheet1").Range("A1").Value


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in

message ...
Ron
Me again.
If the sh.protect "ron" is the password - is it possible
to make it look at a cell in the spreadsheet - otherwise
the password just runs and doesn't need to be entered.

It
would be good to have the person enter the password

(once)
manually to make it more protected.
something like - sh.Unprotect = sh.name cell ##

Does that make sense?

Thanks again - Sam
-----Original Message-----
Try this Sam

Sub prot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ron"
Next sh
Application.ScreenUpdating = True
End Sub

Sub unprot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Unprotect "ron"
Next sh
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in

message ...
Hi
I need to protect multiple worksheets to lock cells.

Only
way I can see to do this is to go into individual

sheets
and do this. The 'protect sheet' option is greyed

out
when multiple sheets are open.
Is it therefore possible to run a macro to protect /
unprotect worksheets with a password?
Thanking you in advance. Sam


.



.

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
Macro for protecting and unprotecting multiple worksheets saltnsnails Excel Discussion (Misc queries) 7 January 24th 08 10:49 PM
Protecting Multiple Worksheets at the same time Doug P. Excel Worksheet Functions 1 September 20th 07 02:48 AM
Protecting multiple worksheets. Superjet Excel Discussion (Misc queries) 2 February 2nd 06 07:06 PM
Protecting Worksheets Kathy081403 Excel Worksheet Functions 2 January 12th 06 12:56 AM
protecting multiple worksheets Sue Excel Discussion (Misc queries) 2 September 12th 05 08:40 PM


All times are GMT +1. The time now is 09:36 AM.

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

About Us

"It's about Microsoft Excel"