Jump to content

Password change using VBA in Excel 2003.

- - - - -

  • Please log in to reply
No replies to this topic

#1
WolfEyes

WolfEyes

    Newbie

  • Members
  • Pip
  • 5 posts
Hi Guys

I hope you are able to help me.

I'am using Windows 7 and Excel 2003.

A workbook we use has a Management Information sheet, the MI sheet is Password protected but I need to give the ability for those that have access to change their password themselves.

I have used a UserForm to allow those with access to the MI sheet to change their password. The Userform has 2 Text boxes and 2 Command Buttons. Text Box 1 allows the user to enter their current password, if that is correct when using the Command Button to enter the old password it takes you to a hidden frame with a further Text Box to enter the new Password and the Command Button 2 changes the Password. This interacts with a seperate spreadsheet called Pass that stores the users and their passwords.

At present it works fine but only for the first user and no one else.

The code is as follows:

Private Sub CommandButton1_Click()

If TextBox1.Value = Sheet2.Range("B2").Value Then

  Frame1.Visible = True

  Me.Height = 90

Else: Unload Me

End If

End Sub


Private Sub CommandButton2_Click()

Sheet2.Range("B2").Value = TextBox2.Value


Unload Me


End Sub

The passwords are stored in Column range B2:B20

Can anyone help with the code so that it changes any of the possible passwords that could be used between the range B2:B20. As I said at the moment it only works for the password in B2(the first user)

I have attached a picture of the pass page and the userform to help anyone kind enough to help

Thank You

Attached Files






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users