Thread: Amend the Code
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
shan_in_dubai shan_in_dubai is offline
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