Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. Sub userName()
  2.  
  3. Dim i As Integer
  4.  
  5. For i = 2 To 603
  6. Dim lastName As String
  7. lastName = Cells(i, 3).Value
  8.  
  9. Dim firstName As String
  10. firstName = Cells(i, 2).Value
  11. firstName = Left(firstName, 1)
  12.  
  13. Dim userName As String
  14. userName = lastName + firstName
  15. userName = Replace(userName, " ", "")
  16. userName = LCase(userName)
  17. Cells(i, 4).Value = userName
  18.  
  19. Dim password As Integer
  20. password = Int((1000 - 0 + 1) * Rnd + 0)
  21. Cells(i, 5).Value = password
  22.  
  23. Dim coAccount1 As String
  24. coAccount1 = userName & password
  25. Cells(i, 6).Value = coAccount1
  26.  
  27. Dim coAccount2 As String
  28. coAccount2 = userName & password
  29. Cells(i, 7).Value = coAccount2
  30.  
  31. Dim s As String
  32. s = Cells(i, 8).Value
  33. cs = 0
  34.  
  35.  
  36. digit = Mid(s, i, 1) - "0" 'get the next digit from bar code text
  37. If i Mod 2 = 0 Then
  38. cs = cs + digit * 3 'multiply each bar code digit by it's weight, 1 or 3
  39. Else
  40. cs = cs + digit * 1
  41. End If
  42.  
  43.  
  44. cs = (10 - (cs Mod 10)) Mod 10 'which digit must be added to cs to make it divisible by 10
  45.  
  46. Cells(i, 9).Value = Str(cs)
  47. Next i
  48. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement