muhleebbin
Active Member
- Joined
- Sep 30, 2017
- Messages
- 252
- Office Version
- 365
- 2019
- 2016
- 2013
- 2010
- Platform
- Windows
- MacOS
- Mobile
- Web
Hi,
Could someone help me with a piece of code where it locks a value that's on another worksheet and would only update the value on that worksheet upon a key stroke?
I'm trying to build a password generator for our company software but it's currently copying a new password for every instance rather than just keeping the same password that's in the first cell. Examples below:
I have code that is supposed to copy the values in all the cells but when it copies it refreshes the password generator each time so a new password is created for each program. Code is:
Could someone help me with a piece of code where it locks a value that's on another worksheet and would only update the value on that worksheet upon a key stroke?
I'm trying to build a password generator for our company software but it's currently copying a new password for every instance rather than just keeping the same password that's in the first cell. Examples below:
Password Generator v2.xlsm | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | ||||||||||||
2 | Series | Type | Characters | Random Number | Index | Characters | ||||||
3 | 1st | Random Number | 7 | 1.0003 | 8 | - | Password | -j7J.yJ9 | ||||
4 | Random Uppercase Letter | J | 5.0004 | 3 | j | |||||||
5 | Random Lowercase Letter | j | 8.0005 | 1 | 7 | Click F9 to regenarate | ||||||
6 | Random Symbol | . | 7.0006 | 2 | J | |||||||
7 | 2nd | Random Number | 9 | 3.0007 | 4 | . | ||||||
8 | Random Uppercase Letter | J | 1.0008 | 7 | y | |||||||
9 | Random Lowercase Letter | y | 2.0009 | 6 | J | |||||||
10 | Random Symbol | - | 2.001 | 5 | 9 | |||||||
11 | ||||||||||||
PW Generator |
Cell Formulas | ||
---|---|---|
Range | Formula | |
D3,D7 | D3 | =RANDBETWEEN(0,9) |
E3:E10 | E3 | =RANDBETWEEN(1,8)+ROW()/10000 |
F3:F10 | F3 | =RANK(E3,$E$3:$E$10) |
G3:G10 | G3 | =INDEX($D$3:$D$10,F3) |
D4,D8 | D4 | =CHAR(RANDBETWEEN(65,90)) |
D5,D9 | D5 | =CHAR(RANDBETWEEN(97,122)) |
D6,D10 | D6 | =CHAR(RANDBETWEEN(33,47)) |
J3 | J3 | =CONCATENATE(G3,G4,G5,G6,G7,G8,G9,G10) |
Password Generator v2.xlsm | ||||||
---|---|---|---|---|---|---|
D | E | F | G | |||
3 | Location: | Location3 | ||||
4 | Position: | Test3 | ||||
5 | Detailed Position: | Test 3.1 | ||||
6 | Name: | John Doe | ||||
7 | Email: | jdoe@email.com | ||||
8 | ||||||
9 | Program | |||||
10 | Program1 | jdoe | Zz1uZ&2) | |||
11 | Program3 | jdoe | q+D)n5Z9 | |||
12 | Program4 | Email Setup | ||||
13 | Program6 | jdoe@e.com | n1d2L//K | |||
14 | Program7 | johndoe | UlL9-.p8 | Company | ||
Input |
Cells with Data Validation | ||
---|---|---|
Cell | Allow | Criteria |
E3 | List | =Lists!$M$2:$M$12 |
E4 | List | =Validation_List |
E5 | List | =INDIRECT(SUBSTITUTE(E4," ","")) |
I have code that is supposed to copy the values in all the cells but when it copies it refreshes the password generator each time so a new password is created for each program. Code is:
VBA Code:
Sub UpdateLogWorksheet()
Dim historyWks As Worksheet
Dim inputWks As Worksheet
Dim nextRow As Long
Dim oCol As Long
Dim myRng As Range
Dim myCopy As String
Dim myCell As Range
'cells to copy from Input sheet - some contain formulas
myCopy = "E3,E4,E5,E6,E7,D10:G40"
Set inputWks = Worksheets("Input")
Set historyWks = Worksheets("Data")
With historyWks
nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
End With
With inputWks
Set myRng = .Range(myCopy)
End With
With historyWks
With .Cells(nextRow, "A")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
.Cells(nextRow, "B").Value = Application.UserName
oCol = 3
For Each myCell In myRng.Cells
historyWks.Cells(nextRow, oCol).Value = myCell.Value
oCol = oCol + 1
Next myCell
End With
'clear input cells that contain constants
With inputWks
On Error Resume Next
With .Range(myCopy).Cells.SpecialCells(xlCellTypeConstants)
.ClearContents
Application.GoTo .Cells(1) ', Scroll:=True
End With
On Error GoTo 0
End With
'formula fill ins
End Sub
Last edited: