password Fail

B4L4KS

Board Regular
Joined
Mar 7, 2011
Messages
69
this is my password VBA

why wont it work
Private Sub Worksheet_Active()
Range("iv1111").Select
Retry:
x = InputBox("Enter password")
If x <> "slade" Then
If MsgBox("Invalid password.", vbRetryCancel) = vRetry Then GoTo Retry
Sheet1.Activate
Else
Range("a1").Select
End If
End Sub
any help please

kristian
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Rich (BB code):
Private Sub Worksheet_Active()
Range("iv1111").Select
Retry:
x = InputBox("Enter password")
If x <> "slade" Then
    If MsgBox("Invalid password.", vbRetryCancel) = vbRetry Then GoTo Retry
    Sheet1.Activate
Else
    Range("a1").Select
End If
End Sub

:)
 
Upvote 0
hi thanks for the help

but it still doesnt work

it goes to the cell and page but no password entry
 
Upvote 0
What do you want it to do?

I get the Password box, it works if you enter slade and fails if it doesn't

All you gave as a clue was "Why doesn't it work"

It wouldn't have worked because you were missing a letter in your code - Beyond that, it's anyones guess really :)
 
Upvote 0
i want to enter a page with restricted access so no one can enter without a password

hense why i have put the location at the bottom of the sheet?

Kristian
 
Upvote 0
Sorry, another mistake I didn't spot before :)

Try using this

Rich (BB code):
Private Sub Worksheet_Activate()
Range("iv1111").Select
Retry:
x = InputBox("Enter password")
If x <> "slade" Then
    If MsgBox("Invalid password.", vbRetryCancel) = vbRetry Then GoTo Retry
    Sheet1.Activate
Else
    Range("a1").Select
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,617
Messages
6,179,914
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top