Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Macro and Protected Sheet Problem

I have macros that hide rows and I want to protect my sheet so individuals
will not be able to change any of the information. When the sheet is
protected the macro will not work. It goes to a debuger.

Is there a way to run my macros even though the sheet is protected?

Thank you,

Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Macro and Protected Sheet Problem

Just turn protection off temporarily for the sheet:
Sub YourMacro()
Worksheets("SheetName").Unprotect
' macro code here
Worksheets("SheetName").Protect
End Sub
--
- K Dales


"Daniel R. Young" wrote:

I have macros that hide rows and I want to protect my sheet so individuals
will not be able to change any of the information. When the sheet is
protected the macro will not work. It goes to a debuger.

Is there a way to run my macros even though the sheet is protected?

Thank you,

Daniel

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Macro and Protected Sheet Problem

In your macro, unprotect the sheet, hide the rows, protect the sheet. HTH
Otto
"Daniel R. Young" wrote in message
...
I have macros that hide rows and I want to protect my sheet so individuals
will not be able to change any of the information. When the sheet is
protected the macro will not work. It goes to a debuger.

Is there a way to run my macros even though the sheet is protected?

Thank you,

Daniel



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Macro and Protected Sheet Problem

Daniel,

There is an alternative - check out the below code...
=======================================
Select UnProtected Cells ONLY
This will prevent users from clicking on protected cells on all
worksheets. Therefore, the warning message will not appear. The code
must be enterred in the ThisWorkbook module.

Note that the EnableSelection property must be reset each time the
workbook is opened as it defaults to xlNoRestrictions. The
worksheet(s)
must first be unprotected to set the EnableSelection property and then
must be protected for it to take effect.

Private Sub Workbook_Open()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
WS.Unprotect 'Password:="wxyz"
WS.EnableSelection = xlUnlockedCells
WS.Protect 'Password:="wxyz", UserInterfaceOnly:=True
Next
End Sub

Regards,
Greg Wilson 5/3/03


--
steveB

Remove "AYN" from email to respond
"Otto Moehrbach" wrote in message
...
In your macro, unprotect the sheet, hide the rows, protect the sheet.
HTH Otto
"Daniel R. Young" wrote in
message ...
I have macros that hide rows and I want to protect my sheet so individuals
will not be able to change any of the information. When the sheet is
protected the macro will not work. It goes to a debuger.

Is there a way to run my macros even though the sheet is protected?

Thank you,

Daniel





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Macro and Protected Sheet Problem

It worked thank you!

"Daniel R. Young" wrote:

I have macros that hide rows and I want to protect my sheet so individuals
will not be able to change any of the information. When the sheet is
protected the macro will not work. It goes to a debuger.

Is there a way to run my macros even though the sheet is protected?

Thank you,

Daniel

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 & Protected sheet Lise Excel Discussion (Misc queries) 2 April 11th 10 10:36 PM
Combobox problem in protected sheet Oguz Excel Discussion (Misc queries) 0 March 27th 08 11:26 AM
Problem doing Query to Access with Excel sheet protected Harry[_8_] Excel Programming 3 February 26th 05 03:46 PM
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet arunjoshi[_5_] Excel Programming 1 May 2nd 04 03:50 PM
Solver via VBA on protected sheet problem josvr Excel Programming 4 October 2nd 03 02:20 AM


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