LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Macro to unprotect workbook

cheers

"Ron de Bruin" wrote in message
...
Yes

You use sheets in your loop
There are no cells in a chart sheet that's why your code blow.

Change sheets to worksheets in the code(2*) and it will work for all the

worksheets



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



"Mike" wrote in message

...
Yes - is that a problem now?

Mike


"Ron de Bruin" wrote in message
...
Hi Mike

Do you have a Chart sheet in the workbook??

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



"Mike" wrote in message

...
Hi

I have the following macros coded to protect and unprotect a

workbook
I'm
working on. However, when I try to unprotect the workbook using
UnprotectAllSheets(), it keeps failing, particularly with reference

to
the
part ".Cells.FormulaHidden = False". This had worked fine for a

while,
but
now that other macros have been put into the workbook, it now seems

to
fail.

Has anybody any thoughts on what might be causing this? Thanks in

advance
for any help.

Mike


Sub UnprotectAllSheets()

Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
With Sheets(n)
.Unprotect Password:="password"
.Cells.FormulaHidden = False
End With
Next n
Application.ScreenUpdating = True

End Sub


Sub ProtectAllSheets()

Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="password"

Next n
Application.ScreenUpdating = True

End Sub


Sub HideFormulaCode()

Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
With Sheets(n)
.Cells.FormulaHidden = True
.Protect Password:="password"

End With
Next n
Application.ScreenUpdating = True

End Sub










 
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
Unprotect workbook Kim Excel Discussion (Misc queries) 3 October 2nd 08 07:49 PM
Unprotect workbook Jana Excel Discussion (Misc queries) 0 July 5th 07 04:04 PM
How to unprotect a workbook by macro? FARAZ QURESHI Excel Discussion (Misc queries) 4 December 29th 06 12:27 AM
Unprotect Workbook Kent Excel Discussion (Misc queries) 1 February 4th 05 01:07 AM
Unprotect a Workbook Milind Excel Programming 0 September 10th 03 10:59 PM


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