Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Amend the Code


Dear Experts,

please amend the following code to turn off the Workbook & Worksheet
protections while the following code runs & turn on protection again at
the end.
Workbook password "xyz" worksheet password "xyz"

------------------------------------------------------------------------------------------
Sub Button1_Click()
Dim Pass As String

Pass = InputBoxDK("Please enter your password", "Hide Sheets")

If Pass = "123" Then
If Worksheets("a").Visible = True Then
Sheets(Array("a", "b", "c", "d")).Visible = False
Else
Sheets("a").Visible = True
Sheets("b").Visible = True
Sheets("c").Visible = True
Sheets("d").Visible = True
End If
Else
MsgBox "Incorrect password", vbCritical, "Invalid Password"
End If

End Sub
--------------------------------------------------------------------------------------------------


Thanks for your efforts.

S h a n


--
shan_in_dubai
------------------------------------------------------------------------
shan_in_dubai's Profile: http://www.excelforum.com/member.php...o&userid=25307
View this thread: http://www.excelforum.com/showthread...hreadid=387928

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Amend the Code


Like this :-
Worksheets("A").Unprotect password:="xx"
Workbooks("Book1.xls").Unprotect password:="xx"



Don't forget to re-protect afterwards

--
Brian

-----------------------------------------------------------------------
BrianB's Profile: http://www.excelforum.com/member.php...tinfo&userid=5
View this thread: http://www.excelforum.com/showthread.php?threadid=38792

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
amend a VB code please Morgan Excel Discussion (Misc queries) 0 March 3rd 10 11:17 PM
Amend code gavmer[_75_] Excel Programming 1 September 22nd 04 12:57 AM
Amend open Workbook code Stuart[_5_] Excel Programming 3 February 7th 04 04:55 PM
Amend code or change it completely? Gareth[_3_] Excel Programming 2 December 1st 03 07:24 PM
Amend form code to allow an option Stuart[_5_] Excel Programming 3 October 23rd 03 08:11 PM


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