Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub userName()
- Dim i As Integer
- For i = 2 To 603
- Dim lastName As String
- lastName = Cells(i, 3).Value
- Dim firstName As String
- firstName = Cells(i, 2).Value
- firstName = Left(firstName, 1)
- Dim userName As String
- userName = lastName + firstName
- userName = Replace(userName, " ", "")
- userName = LCase(userName)
- Cells(i, 4).Value = userName
- Dim password As Integer
- password = Int((1000 - 0 + 1) * Rnd + 0)
- Cells(i, 5).Value = password
- Dim coAccount1 As String
- coAccount1 = userName & password
- Cells(i, 6).Value = coAccount1
- Dim coAccount2 As String
- coAccount2 = userName & password
- Cells(i, 7).Value = coAccount2
- Dim s As String
- s = Cells(i, 8).Value
- cs = 0
- digit = Mid(s, i, 1) - "0" 'get the next digit from bar code text
- If i Mod 2 = 0 Then
- cs = cs + digit * 3 'multiply each bar code digit by it's weight, 1 or 3
- Else
- cs = cs + digit * 1
- End If
- cs = (10 - (cs Mod 10)) Mod 10 'which digit must be added to cs to make it divisible by 10
- Cells(i, 9).Value = Str(cs)
- Next i
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement