l need to write the VBA code to come up with a 2-character password in the format ‘LetterNumber’ (A-Z and 0-9) in cell G4. Examples of valid passwords include A5, M0, Z8, and so on in cell G4.
The correct password will change the text in cell G5 from “No” to “Yes”.
My code is followed:
Dim pw As String
Dim i As Integer
For i = 1 To 2
If i Mod 2 = 0 Then
pw = pw & Int((9 - 0 + 1) * RND + 0)
pw = pw & Chr(Int((90 - 65 + 1) * RND + 65))
ThisWorkbook.Sheets("Login").Cells(4, 7).Value = pw
If ThisWorkbook.Sheets("Login").Cells(5, 7).Value <> "NO" Then
I can generate right format of password, but once with loop, my vba will stuck when I run!
pleas help me, I'll be really appreciated!
This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our community organized so users can more easily find information.
As you’ll notice, your topic is now here in the Project Development Help and Advice board. No action is needed on your part; you can continue the conversation as normal here.
Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!