KlausW
Active Member
- Joined
- Sep 9, 2020
- Messages
- 469
- Office Version
- 2016
- Platform
- Windows
Hi,
can anyone help me get this VBA code to run when a code that starts with Private Sub Worksheet_SelectionChange(ByVal Target As Range) is run?
The vba codes are in the same sheet.
All help would be appreciated.
Best regards Klaus W
can anyone help me get this VBA code to run when a code that starts with Private Sub Worksheet_SelectionChange(ByVal Target As Range) is run?
The vba codes are in the same sheet.
All help would be appreciated.
Best regards Klaus W
VBA Code:
Sub macro1()
Static Passed As Boolean
Dim P$
If Target.Address <> "$A$42" Or Passed Then Exit Sub
Do
P = InputBox(vbLf & vbLf & "Indtast adgangskode for at ændre denne celle:", "Begrænset adgang")
If P = "" Then Target(1, 2).Select: Exit Sub
Loop Until P = "XXXXXXX"
Passed = True
End Sub