Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default protecting sheets from a macro

I am running a macro from an option button in a sheet
named "Summary". The macro make s various formatting
changes, but it needs to unprotect the sheet first. I am
running the following code, but the I get a run time error
when it executes. Can any one help?

Password = "Testpassword"
Worksheets("Summary").Select
Worksheets("Summary").Unprotect Password:=Password

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default protecting sheets from a macro

Here is a copy of a macro that I wrote...See if this helps
Sub unprotect_workbook_cc()
Dim password
password = InputBox("Please Enter Your Password!")
If password = "3579" Then
ActiveWorkbook.Unprotect password:="3579"
Sheets("chris").Visible = True
Else
MsgBox "Incorrect Password, Please Enter Again.",
vbExclamation
End If
End Sub
-----Original Message-----
I am running a macro from an option button in a sheet
named "Summary". The macro make s various formatting
changes, but it needs to unprotect the sheet first. I am
running the following code, but the I get a run time

error
when it executes. Can any one help?

Password = "Testpassword"
Worksheets("Summary").Select
Worksheets("Summary").Unprotect Password:=Password

.

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
Protecting/Unprotecting all sheets with macro leads to "image" iss MikeR Excel Worksheet Functions 3 February 22nd 10 09:33 PM
Help w/ protecting all sheets cnote Excel Discussion (Misc queries) 6 June 27th 06 01:38 PM
Protecting Macro and selected sheets ST Excel Discussion (Misc queries) 1 June 6th 06 03:03 PM
Protecting Sheets Joyce Excel Worksheet Functions 3 March 20th 06 08:18 PM
Protecting sheets TV Excel Discussion (Misc queries) 1 November 29th 04 09:27 PM


All times are GMT +1. The time now is 02:17 AM.

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"