xoScarecrowox
New Member
- Joined
- Apr 2, 2019
- Messages
- 15
Hi
I have written a macro that enters the excel login user name into a locked cell and then locks the sheet from further editing. My formula is below. I am looking for a way to limit the people who can approve the form, either by checking against a predefined list or contained within the macro, any help appreciated.
Private Sub CommandButton1_Click()
ActiveSheet.UnprotectPassword:="Pass"
Sheet1.Range("$b$34").Value =Application.UserName
ActiveSheet.ProtectPassword:="Pass"
ActiveSheet.UnprotectPassword:="Pass"
Sheet1.Range("$b$35").Value ="Approved"
ActiveSheet.ProtectPassword:="Pass"
End Sub
Private Sub CommandButton3_Click()
ActiveSheet.UnprotectPassword:="Pass"
Sheet1.Range("$b$42").Value =Application.UserName
ActiveSheet.ProtectPassword:="Pass"
ActiveSheet.UnprotectPassword:="Pass"
Sheet1.Range("$b$43").Value ="Approved"
ActiveSheet.ProtectPassword:="Pass"
End Sub
Private Sub Worksheet_Change(ByValTarget As Range)
If Range("B35") = "Approved" Then
ActiveSheet.Unprotect Password:="Pass"
Range("A2:B33").Locked = True
ActiveSheet.Protect Password:="Pass"
End If
End Sub
I have written a macro that enters the excel login user name into a locked cell and then locks the sheet from further editing. My formula is below. I am looking for a way to limit the people who can approve the form, either by checking against a predefined list or contained within the macro, any help appreciated.
Private Sub CommandButton1_Click()
ActiveSheet.UnprotectPassword:="Pass"
Sheet1.Range("$b$34").Value =Application.UserName
ActiveSheet.ProtectPassword:="Pass"
ActiveSheet.UnprotectPassword:="Pass"
Sheet1.Range("$b$35").Value ="Approved"
ActiveSheet.ProtectPassword:="Pass"
End Sub
Private Sub CommandButton3_Click()
ActiveSheet.UnprotectPassword:="Pass"
Sheet1.Range("$b$42").Value =Application.UserName
ActiveSheet.ProtectPassword:="Pass"
ActiveSheet.UnprotectPassword:="Pass"
Sheet1.Range("$b$43").Value ="Approved"
ActiveSheet.ProtectPassword:="Pass"
End Sub
Private Sub Worksheet_Change(ByValTarget As Range)
If Range("B35") = "Approved" Then
ActiveSheet.Unprotect Password:="Pass"
Range("A2:B33").Locked = True
ActiveSheet.Protect Password:="Pass"
End If
End Sub