我的生成器每次运行时都会生成相同系列的密码
dXEFj1im
e3OpkLxq
4wKWi4SF
yBX7zb17
7kE3FLFw
yNDNNeH6
RsCjLEtP
7Zdtn1Xt
.
.
.
etc
任何人都可以看到需要更改的内容,我玩过我不知道如何修复它。谢谢
功能
Function Pwd(ByVal strTemp As String) As String
Dim i As Integer, iTemp As Integer, bOK As Boolean, iLength As Integer
'48-57 = 0 To 9, 65-90 = A To Z, 97-122 = a To z
'amend For other characters If required
For i = 1 To 8
Do
iTemp = Int((122 - 48 + 1) * Rnd + 48)
Select Case iTemp
Case 48 To 57, 65 To 90, 97 To 122: bOK = True
Case Else: bOK = False
End Select
Loop Until bOK = True
bOK = False
strTemp = strTemp & Chr(iTemp)
' Initialize the seed using Timer.
Randomize (Timer)
Next i
Pwd = strTemp
End Function
潜艇
Sub RanPassword()
Dim rng As range
Dim LastRow As Long
With Sheets("sheet1")
LastRow = .range("E" & .Rows.Count).End(xlUp).Row
End With
For Each rng In Sheets("Sheet1").range("B2:B" & LastRow)
rng.Value = Pwd(rng.Value)
Next
End Sub