#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Password Protection

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I also have ranges within these spreadsheets that need
to be able to be unlocked with a different password. I'm looking for a way to
write a macro to be able to do this to all the spreadsheets with one click. I
have already found how to just password protect with a macro, but can someone
please show me how to add the ablity to allow user to edit ranges in the
macro. This is the macro I am presently using....

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Thanks so much for any help!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Password Protection

You need to unlock those cells. Suppose you want to enable the user to edit
A1:B10 range for all worksheets; try the below. Please note that the below
macro will work on the workbook where the macro is copied

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1:B10").Locked = False
ws.Protect Password:="123"
Next ws
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ladytiger7481" wrote:

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I also have ranges within these spreadsheets that need
to be able to be unlocked with a different password. I'm looking for a way to
write a macro to be able to do this to all the spreadsheets with one click. I
have already found how to just password protect with a macro, but can someone
please show me how to add the ablity to allow user to edit ranges in the
macro. This is the macro I am presently using....

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Thanks so much for any help!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Password Protection

I think I am going about this all wrong. What I need my macro to do is
protect two seperate ranges of cells say D8:D43 and F8:F43 which have
formulas, all the other areas can be edited. However I have 31 spreadsheets
in this workbook. How should this macro be set up so that I can protect only
thoses ranges on all sheets without having to go in to all the sheets.
(Trying what you told me earlier worked but not in the way that I was looking
for it too)
Thanks!!

"Jacob Skaria" wrote:

You need to unlock those cells. Suppose you want to enable the user to edit
A1:B10 range for all worksheets; try the below. Please note that the below
macro will work on the workbook where the macro is copied

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1:B10").Locked = False
ws.Protect Password:="123"
Next ws
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ladytiger7481" wrote:

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I also have ranges within these spreadsheets that need
to be able to be unlocked with a different password. I'm looking for a way to
write a macro to be able to do this to all the spreadsheets with one click. I
have already found how to just password protect with a macro, but can someone
please show me how to add the ablity to allow user to edit ranges in the
macro. This is the macro I am presently using....

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Thanks so much for any help!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Password Protection

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Cells.Locked = False
ws.Range("D8:D43,F8:F43").Locked = True
ws.Protect Password:="123"
Next ws
End Sub


Gord Dibben MS Excel MVP

On Wed, 19 Aug 2009 14:19:01 -0700, ladytiger7481
wrote:

I think I am going about this all wrong. What I need my macro to do is
protect two seperate ranges of cells say D8:D43 and F8:F43 which have
formulas, all the other areas can be edited. However I have 31 spreadsheets
in this workbook. How should this macro be set up so that I can protect only
thoses ranges on all sheets without having to go in to all the sheets.
(Trying what you told me earlier worked but not in the way that I was looking
for it too)
Thanks!!

"Jacob Skaria" wrote:

You need to unlock those cells. Suppose you want to enable the user to edit
A1:B10 range for all worksheets; try the below. Please note that the below
macro will work on the workbook where the macro is copied

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1:B10").Locked = False
ws.Protect Password:="123"
Next ws
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ladytiger7481" wrote:

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I also have ranges within these spreadsheets that need
to be able to be unlocked with a different password. I'm looking for a way to
write a macro to be able to do this to all the spreadsheets with one click. I
have already found how to just password protect with a macro, but can someone
please show me how to add the ablity to allow user to edit ranges in the
macro. This is the macro I am presently using....

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Thanks so much for any help!


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Password Protection

You may want to unprotect all sheets at some point.

Sub UN_Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:="123"
Next ws
End Sub

I would also suggest you lock your project from viewing.

In VBE select your workbook/project and ToolsVBAProject
PropertiesProtection

Viewing Protection won't take effect until you save and close/reopen the
workbook.


Gord

On Wed, 19 Aug 2009 14:34:36 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Cells.Locked = False
ws.Range("D8:D43,F8:F43").Locked = True
ws.Protect Password:="123"
Next ws
End Sub


Gord Dibben MS Excel MVP

On Wed, 19 Aug 2009 14:19:01 -0700, ladytiger7481
wrote:

I think I am going about this all wrong. What I need my macro to do is
protect two seperate ranges of cells say D8:D43 and F8:F43 which have
formulas, all the other areas can be edited. However I have 31 spreadsheets
in this workbook. How should this macro be set up so that I can protect only
thoses ranges on all sheets without having to go in to all the sheets.
(Trying what you told me earlier worked but not in the way that I was looking
for it too)
Thanks!!

"Jacob Skaria" wrote:

You need to unlock those cells. Suppose you want to enable the user to edit
A1:B10 range for all worksheets; try the below. Please note that the below
macro will work on the workbook where the macro is copied

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1:B10").Locked = False
ws.Protect Password:="123"
Next ws
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ladytiger7481" wrote:

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I also have ranges within these spreadsheets that need
to be able to be unlocked with a different password. I'm looking for a way to
write a macro to be able to do this to all the spreadsheets with one click. I
have already found how to just password protect with a macro, but can someone
please show me how to add the ablity to allow user to edit ranges in the
macro. This is the macro I am presently using....

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Thanks so much for any help!




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Password Protection

I have ran in to another issue with my protection that I can't figure out.
Once I put my protection on my cells with formulas...which I now have with my
macros perfectly... my formulas will not automatically update based on the
entries in the other cells that are inclucded in the formula. I actually have
to save the workbook before my changes show in my formula. Is there something
that I am missing?

Thanks for the help!

"Gord Dibben" wrote:

You may want to unprotect all sheets at some point.

Sub UN_Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:="123"
Next ws
End Sub

I would also suggest you lock your project from viewing.

In VBE select your workbook/project and ToolsVBAProject
PropertiesProtection

Viewing Protection won't take effect until you save and close/reopen the
workbook.


Gord

On Wed, 19 Aug 2009 14:34:36 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Cells.Locked = False
ws.Range("D8:D43,F8:F43").Locked = True
ws.Protect Password:="123"
Next ws
End Sub


Gord Dibben MS Excel MVP

On Wed, 19 Aug 2009 14:19:01 -0700, ladytiger7481
wrote:

I think I am going about this all wrong. What I need my macro to do is
protect two seperate ranges of cells say D8:D43 and F8:F43 which have
formulas, all the other areas can be edited. However I have 31 spreadsheets
in this workbook. How should this macro be set up so that I can protect only
thoses ranges on all sheets without having to go in to all the sheets.
(Trying what you told me earlier worked but not in the way that I was looking
for it too)
Thanks!!

"Jacob Skaria" wrote:

You need to unlock those cells. Suppose you want to enable the user to edit
A1:B10 range for all worksheets; try the below. Please note that the below
macro will work on the workbook where the macro is copied

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1:B10").Locked = False
ws.Protect Password:="123"
Next ws
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ladytiger7481" wrote:

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I also have ranges within these spreadsheets that need
to be able to be unlocked with a different password. I'm looking for a way to
write a macro to be able to do this to all the spreadsheets with one click. I
have already found how to just password protect with a macro, but can someone
please show me how to add the ablity to allow user to edit ranges in the
macro. This is the macro I am presently using....

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Thanks so much for any help!



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Password Protection

The missing part is that you have calculation set to Manual/Calc on Save.

Change it back to Automatic.

ToolsOptionsCalculation or in 2007

OrbExcel OptionsAdvancedFormulas......uncheck Manual


Gord

On Wed, 19 Aug 2009 21:15:01 -0700, ladytiger7481
wrote:

I have ran in to another issue with my protection that I can't figure out.
Once I put my protection on my cells with formulas...which I now have with my
macros perfectly... my formulas will not automatically update based on the
entries in the other cells that are inclucded in the formula. I actually have
to save the workbook before my changes show in my formula. Is there something
that I am missing?

Thanks for the help!

"Gord Dibben" wrote:

You may want to unprotect all sheets at some point.

Sub UN_Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:="123"
Next ws
End Sub

I would also suggest you lock your project from viewing.

In VBE select your workbook/project and ToolsVBAProject
PropertiesProtection

Viewing Protection won't take effect until you save and close/reopen the
workbook.


Gord

On Wed, 19 Aug 2009 14:34:36 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Cells.Locked = False
ws.Range("D8:D43,F8:F43").Locked = True
ws.Protect Password:="123"
Next ws
End Sub


Gord Dibben MS Excel MVP

On Wed, 19 Aug 2009 14:19:01 -0700, ladytiger7481
wrote:

I think I am going about this all wrong. What I need my macro to do is
protect two seperate ranges of cells say D8:D43 and F8:F43 which have
formulas, all the other areas can be edited. However I have 31 spreadsheets
in this workbook. How should this macro be set up so that I can protect only
thoses ranges on all sheets without having to go in to all the sheets.
(Trying what you told me earlier worked but not in the way that I was looking
for it too)
Thanks!!

"Jacob Skaria" wrote:

You need to unlock those cells. Suppose you want to enable the user to edit
A1:B10 range for all worksheets; try the below. Please note that the below
macro will work on the workbook where the macro is copied

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1:B10").Locked = False
ws.Protect Password:="123"
Next ws
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ladytiger7481" wrote:

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I also have ranges within these spreadsheets that need
to be able to be unlocked with a different password. I'm looking for a way to
write a macro to be able to do this to all the spreadsheets with one click. I
have already found how to just password protect with a macro, but can someone
please show me how to add the ablity to allow user to edit ranges in the
macro. This is the macro I am presently using....

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Thanks so much for any help!




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
Password protection [email protected] Excel Discussion (Misc queries) 5 February 19th 08 05:13 AM
Password Protection ralph Excel Discussion (Misc queries) 2 April 17th 06 09:56 PM
Password Protection sylvia Excel Discussion (Misc queries) 1 December 2nd 05 04:15 PM
Password Protection Dave123 Excel Discussion (Misc queries) 2 October 4th 05 11:13 AM
Password Protection JamesD Excel Discussion (Misc queries) 1 April 7th 05 02:36 PM


All times are GMT +1. The time now is 12:14 PM.

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"