Only approve form if name is in a list

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




 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,214,858
Messages
6,121,960
Members
449,057
Latest member
FreeCricketId

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top