Inputbox "choose password"

  • Thread starter Thread starter Jonsson
  • Start date Start date
J

Jonsson

Hi,

I need help to create a code that ask for ""what password do you choose to
have" the first time the user tries to access the sheet.
Then, when the password once is choosed, that password is the one to be
written to get acces to the sheet.

I have several solutions to do this by entering a password in the code, but
I want the user to be able himself to choose his own password.

Any idea's?

Thanks in advance

//Thomas

--
--------------------------------------------------------------
Thomas Jonsson
ec2use - Mer tid för kunden

Telefon: 026-19 70 90
Mobil: 070- 547 80 72
--------------------------------------------------------------
 
Hi Jonsson

Do you want to run the macro bu clicking on button on a other sheet???

Is it a hidden sheet or so that you only want to show
if the user know the password. ?
 
Hi Ron!

Like this:

I have a button on sheet1 and click that button, put in the password, it
will give me access to sheet2, that is veryhidden.

//Thomas

Ron de Bruin said:
Hi Jonsson

Do you want to run the macro bu clicking on button on a other sheet???

Is it a hidden sheet or so that you only want to show
if the user know the password. ?
 
Try this

It will use the Cell IV1 to store the password
You can hide that column if you want

Sub test()
Dim Pword As Variant
With Sheets("sheet2")
If .Range("IV1").Value = "" Then
Pword = Application.InputBox("Fill in password that you want to use", "something")
If Pword = False Then
MsgBox "Fill in a the password please", _
vbOKOnly, "something"
Exit Sub
Else
.Range("IV1").Value = Pword
End If

Else
Do Until Pword = .Range("IV1").Value
Pword = Application.InputBox("Fill in the password of the Sheet", "something")
If Pword = False Then
MsgBox "Sorry you must know the password to go to this sheet", _
vbOKOnly, "something"
Exit Sub
End If
Loop
End If
.Visible = -1
.Select
End With
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


Jonsson said:
Hi Ron!

Like this:

I have a button on sheet1 and click that button, put in the password, it
will give me access to sheet2, that is veryhidden.

//Thomas
 
Hi Ron,

You gave me exactly the solution I asked for!
I really apprecciate your help with this!
Thanks,

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top