View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jonsson[_32_] Jonsson[_32_] is offline
external usenet poster
 
Posts: 1
Default code to ask for password to get access to sheet

Hi,

I have put the code I got from this forum, (Thanks Simon) in a module
taken away the apostrophs, and it all works fine, until I type th
password.
I want to get access and automatically jump to the sheet named hidden

Now, I stay put in the same sheet as I have placed the "accessbutton".

What have I missed here?

Thanks in advance

//Thomas

Sub pw()
'
' msg Macro

'
' Keyboard Shortcut: Ctrl+Shift+M
Dim t1 As String
Dim I1 As Integer
Dim I2 As Integer

I1 = MsgBox("Continue", 292, "Password?")
If I1 = 6 Then
For I2 = 1 To 3
t1 = InputBox("Password", "Input", "")
If t1 = "simon" Or t1 = "mark" Then
Sheet("hidden") = t1
Exit Sub
Else
Worksheets("hidden").Visible = True
Worksheets("hidden").Select
ActiveSheet.Range("a2").Select
Selection.Insert Shift:=xlDown
Selection = t1
Worksheets("hidden").Visible = False
End If
Next 'I2

MsgBox "Access denied " & Chr(13) & "The program is closing" & t1
ActiveWorkbook.Close savechanges:=True
End If


End Su

--
Message posted from http://www.ExcelForum.com