Password change using VBA in Excel 2003. (1 Viewer)

WolfEyes

New member
Local time
Today, 05:16
Joined
May 23, 2011
Messages
1
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:

Code:
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 cannot for the life of me get the code to work for any of the Users that wants to change their Password except the User for B2.

I have attached a stripped down version of the workbook.

Thanks in advance.
 

Attachments

  • Pass.xls
    46.5 KB · Views: 319

Users who are viewing this thread

Top Bottom