Excel Question... Again.
Thread Starter
Needs more Lemon Pledge
Joined: Mar 2005
Posts: 52,768
Likes: 2,000
From: Phoenix, AZ
Excel Question... Again.
I have a workbook with 12 worksheets. Each is identical but named for the month it is to be used in. I restrict what can be done in each sheet and where a user can click, resize, etc. by protecting the sheet.
My problem lies in the fact that when I need to make a change, I need to make it 12 times, and I have to go through each sheet and unprotect, make the change, and the protect again with the password.
Is there an easier way to do this?
Small annoying problem: I have to unprotect each sheet individually and then re-protect them.
Large problem: I have to make 12 identical sheets and adjust each one when I want a change made...
My problem lies in the fact that when I need to make a change, I need to make it 12 times, and I have to go through each sheet and unprotect, make the change, and the protect again with the password.
Is there an easier way to do this?
Small annoying problem: I have to unprotect each sheet individually and then re-protect them.
Large problem: I have to make 12 identical sheets and adjust each one when I want a change made...
You can only protect/unprotect sheets one at a time.
To make an identical change in several sheets at a time, select the tabs (through standard click + shift-click or ctrl-click methods) and type the change in once. It will occur in all of the selected worksheets.
To make an identical change in several sheets at a time, select the tabs (through standard click + shift-click or ctrl-click methods) and type the change in once. It will occur in all of the selected worksheets.
Just because it's you...
Open Excel, Hit Alt-F11, open ThisWorkbook, paste this code in.
To run these, view the macros.
Open Excel, Hit Alt-F11, open ThisWorkbook, paste this code in.
To run these, view the macros.
Code:
Sub ProtectEach()
Dim s As Worksheet
Dim pw As String
pw = InputBox("Enter password")
For Each s In Me.Worksheets
s.Protect pw, True, True, True, True, True, True, True, False, False, False, False, False, True, treu, True
Next
MsgBox "Done."
End Sub
Sub UnProtectEach()
Dim s As Worksheet
Dim pw As String
pw = InputBox("Enter password")
For Each s In Me.Worksheets
s.Unprotect pw
Next
MsgBox "Done."
End Sub
Trending Topics
In the spirit of teaching the OP how to fish - other repetitive tasks can be automated using the "record macro" function under the Tools->Macro menu. The recorded macro will look a lot like the one posted above.
Thread Starter
Needs more Lemon Pledge
Joined: Mar 2005
Posts: 52,768
Likes: 2,000
From: Phoenix, AZ
Thanks guys, I have experience recording and using macros, but I was concerned about the macro being accessible to the other users, whom I do not want to be able to un-protect the sheet. Every time I keep the macro in my personal workbook, it seems to end up being available to the general masses...
Thanks guys, I have experience recording and using macros, but I was concerned about the macro being accessible to the other users, whom I do not want to be able to un-protect the sheet. Every time I keep the macro in my personal workbook, it seems to end up being available to the general masses...
Thread
Thread Starter
Forum
Replies
Last Post
08_UA7_Gr33k
Member Cars for Sale
13
Feb 11, 2016 02:17 PM
InFaMouSLink
Car Parts for Sale
6
Oct 27, 2015 06:52 PM
xsilverhawkx
2G TL Problems & Fixes
5
Sep 28, 2015 06:51 PM
08_UA7_Gr33k
Member Cars for Sale
1
Sep 27, 2015 01:56 PM










