tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,834
- Office Version
- 365
- 2019
- Platform
- Windows
I have an ActiveX spin control on my worksheet which is linked to cell A1.
When I click on the spin control, cell A1 changes value.
If the worksheet is protected and I add this code:
cell A1 still changes value, as expected.
However, if this code was added instead:
it fails.
Why is that?
I would've thought the code would kick in, unprotect the sheet then protect it again. Stepping into the code works.
When I click on the spin control, cell A1 changes value.
If the worksheet is protected and I add this code:
Code:
Private Sub SpinButton1_Change()
Me.Unprotect
End Sub
cell A1 still changes value, as expected.
However, if this code was added instead:
Code:
Private Sub SpinButton1_Change()
Me.Unprotect
Me.Protect
End Sub
it fails.
Why is that?
I would've thought the code would kick in, unprotect the sheet then protect it again. Stepping into the code works.