Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
EMN EMN is offline
external usenet poster
 
Posts: 2
Default Multiple tabs

I would like to run a macro to unprotect several worksheets. I would like
the user to select the worksheets that need to be unprotected and run the
macro to unprotect them.

Sub test()
'
' test Macro
'
ActiveSheet.Unprotect
End Sub

How do I make ActiveSheet the selected sheets?

Thank you !!!!!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Multiple tabs

Try this:

Sub UnprotectSelectedSheets()
Dim sh As Worksheet, shts
On Error Resume Next
Set shts = ThisWorkbook.Windows(1).SelectedSheets
For Each sh In shts
sh.Select
ActiveSheet.Unprotect
Next
Set shts = Nothing
End Sub

You will have to modify the Unprotect statement if the sheets are password
protected.

Hope this helps,

Hutch

"EMN" wrote:

I would like to run a macro to unprotect several worksheets. I would like
the user to select the worksheets that need to be unprotected and run the
macro to unprotect them.

Sub test()
'
' test Macro
'
ActiveSheet.Unprotect
End Sub

How do I make ActiveSheet the selected sheets?

Thank you !!!!!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
EMN EMN is offline
external usenet poster
 
Posts: 2
Default Multiple tabs

Thank you for responding, Tom. This did not work for me. When multiple
sheets are selected, it does not unprotect any of them. When the macro is
run with only one sheet selected, it unprotects the one sheet. There is no
password protection. Any thoughts?

"Tom Hutchins" wrote:

Try this:

Sub UnprotectSelectedSheets()
Dim sh As Worksheet, shts
On Error Resume Next
Set shts = ThisWorkbook.Windows(1).SelectedSheets
For Each sh In shts
sh.Select
ActiveSheet.Unprotect
Next
Set shts = Nothing
End Sub

You will have to modify the Unprotect statement if the sheets are password
protected.

Hope this helps,

Hutch

"EMN" wrote:

I would like to run a macro to unprotect several worksheets. I would like
the user to select the worksheets that need to be unprotected and run the
macro to unprotect them.

Sub test()
'
' test Macro
'
ActiveSheet.Unprotect
End Sub

How do I make ActiveSheet the selected sheets?

Thank you !!!!!!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Multiple tabs

Are you trying to unprotect the sheets in a different workbook? The macro, as
written, works only on selected sheets in the same workbook where the macro
is stored. It would also unprotect the active sheet in another workbook
because of the ActiveSheet.Unprotect statement. Try changing this line:

Set shts = ThisWorkbook.Windows(1).SelectedSheets

to this:

Set shts = ActiveWorkbook.Windows(1).SelectedSheets

Hutch

"EMN" wrote:

Thank you for responding, Tom. This did not work for me. When multiple
sheets are selected, it does not unprotect any of them. When the macro is
run with only one sheet selected, it unprotects the one sheet. There is no
password protection. Any thoughts?

"Tom Hutchins" wrote:

Try this:

Sub UnprotectSelectedSheets()
Dim sh As Worksheet, shts
On Error Resume Next
Set shts = ThisWorkbook.Windows(1).SelectedSheets
For Each sh In shts
sh.Select
ActiveSheet.Unprotect
Next
Set shts = Nothing
End Sub

You will have to modify the Unprotect statement if the sheets are password
protected.

Hope this helps,

Hutch

"EMN" wrote:

I would like to run a macro to unprotect several worksheets. I would like
the user to select the worksheets that need to be unprotected and run the
macro to unprotect them.

Sub test()
'
' test Macro
'
ActiveSheet.Unprotect
End Sub

How do I make ActiveSheet the selected sheets?

Thank you !!!!!!


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
How do I move multiple tabs in multiple workbooks to a master? teelee Excel Worksheet Functions 3 October 15th 09 05:03 PM
Average Over Multiple Sheet Tabs with Multiple Values Karen Excel Worksheet Functions 6 February 4th 09 02:29 PM
Create multiple sheet tabs from multiple cells. Robert Maddox Excel Worksheet Functions 17 November 14th 07 10:28 PM
macro: copy multiple workbooks to multiple tabs in single book Michael Excel Programming 0 July 14th 06 04:53 PM
How do I use VLOOKUP to ref multiple workbooks with multiple tabs? JackieW Excel Discussion (Misc queries) 2 April 11th 06 05:32 PM


All times are GMT +1. The time now is 04:04 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"