Creating username and passwords

S

shannyshanhan

I need help creating all lower case usernames made up of the firs
letter of the customers first name and the first 7 letters of thei
last name.


I also need help creating passwords which will be made up of
customers first and last initial, followed by a random 6 digit number
the first character in the password will be lower case and the secon
character will be upper case.

Full Name Last Name First Name Username Password
Boxer, Barbara Boxer Barbara
Cantwell, Maria Cantwell Maria
Craig, Larry Craig Larry
Crapo, Michael Crapo Michael
Ensign, John Ensign John
Feinstein, Dianne Feinstein Dianne
Murray, Patty Murray Patty
Reid, Harry Reid Harry
Smith, Gordon Smith Gordon
Wyden, Ron Wyden Ron

I need help creating functions for these task
 
S

Scoops

shannyshanhan said:
I need help creating all lower case usernames made up of the first
letter of the customers first name and the first 7 letters of their
last name.


I also need help creating passwords which will be made up of a
customers first and last initial, followed by a random 6 digit number.
the first character in the password will be lower case and the second
character will be upper case.

Full Name Last Name First Name Username Password
Boxer, Barbara Boxer Barbara
Cantwell, Maria Cantwell Maria
Craig, Larry Craig Larry
Crapo, Michael Crapo Michael
Ensign, John Ensign John
Feinstein, Dianne Feinstein Dianne
Murray, Patty Murray Patty
Reid, Harry Reid Harry
Smith, Gordon Smith Gordon
Wyden, Ron Wyden Ron

I need help creating functions for these tasks


--
Hi shannyshanhan

As the Random function is volatile, whenever you enter a new user all
previous users' passwords will change and you'll lose your control.

So copy the following code into your worksheet (Right-click the sheet
tab > View Code and paste):

Private Sub Worksheet_Change(ByVal Target As Range)
Dim RndNmbr As String
With Target
Randomize
If .Column = 3 Then
.Offset(0, 1) = LCase(Left(.Offset(0, -1), 1)) &
LCase(Left(.Offset(0, -2), 7))
RndNmbr = Int((999999 - 1 + 1) * Rnd + 1)
Select Case Len(RndNmbr)
Case 1: RndNmbr = "00000" & RndNmbr
Case 2: RndNmbr = "0000" & RndNmbr
Case 3: RndNmbr = "000" & RndNmbr
Case 4: RndNmbr = "00" & RndNmbr
Case 5: RndNmbr = "0" & RndNmbr
End Select
.Offset(0, 2) = LCase(Left(.Offset(0, -1), 1)) &
UCase(Left(.Offset(0, -2), 1)) & RndNmbr
End If
End With
End Sub

This is based on your layout and will fire when the First Name is
entered in column C.

Regards

Steve
 
S

Scoops

Scoops wrote:

But why waste processing time?

Paste this instead (D'oh!):

Private Sub Worksheet_Change(ByVal Target As Range)
Dim RndNmbr As String
With Target
Randomize
If .Column = 4 Then
.Offset(0, 1) = LCase(Left(.Offset(0, -1), 1)) &
LCase(Left(.Offset(0, -2), 7))
RndNmbr = Int((999999 - 100000 + 1) * Rnd + 1)
.Offset(0, 2) = LCase(Left(.Offset(0, -1), 1)) &
UCase(Left(.Offset(0, -2), 1))&RndNmbr
End If
End With
End Sub

Regards

Steve
 

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

Similar Threads


Top