Trevor3007
Well-known Member
- Joined
- Jan 26, 2017
- Messages
- 675
- Office Version
- 365
- Platform
- Windows
good morning,
I want to run a macro that is on sheet 3 (sheet name is CODE ) from sheet 1 (sheet name is LT ) The code is:-
Sub autocode()
Static IsRandomized As Boolean
Dim i As Integer, PW1 As String
Dim cell As Range, PW As String
If Not IsRandomized Then Randomize: IsRandomized = True
For Each cell In Range("b2:b200")
PW = vbNullString
For i = 1 To 8
Do
DoEvents
PW1 = Chr(Int((96 - 123 + 1) * Rnd + 123)) ' Lower case alpha
Loop Until InStr(1, PW, PW1, 1) = 0
PW = PW & PW1
Next i
PW = Replace(PW, Mid(PW, Int(8 * Rnd + 1), 1), Int(8 * Rnd + 1))
cell.Value = PW
Next cell
End Sub
Can anyone help?
Thank you.
KR
Trevor3007
I want to run a macro that is on sheet 3 (sheet name is CODE ) from sheet 1 (sheet name is LT ) The code is:-
Sub autocode()
Static IsRandomized As Boolean
Dim i As Integer, PW1 As String
Dim cell As Range, PW As String
If Not IsRandomized Then Randomize: IsRandomized = True
For Each cell In Range("b2:b200")
PW = vbNullString
For i = 1 To 8
Do
DoEvents
PW1 = Chr(Int((96 - 123 + 1) * Rnd + 123)) ' Lower case alpha
Loop Until InStr(1, PW, PW1, 1) = 0
PW = PW & PW1
Next i
PW = Replace(PW, Mid(PW, Int(8 * Rnd + 1), 1), Int(8 * Rnd + 1))
cell.Value = PW
Next cell
End Sub
Can anyone help?
Thank you.
KR
Trevor3007
Last edited: