I have an application that I made in Excel. I have 2 subs in a module, one to un-protect the active sheet, another to protect.
One of my pages has some cells unlocked. When I call the two subs to protect/un-protect, everything works just fine. In another sheet however... everytime I call one of the two subs, it seems to RE-lock the cells I have set as 'UNLOCKED'.
Subs in module:
Code that seems to be causing the issue:
One of my pages has some cells unlocked. When I call the two subs to protect/un-protect, everything works just fine. In another sheet however... everytime I call one of the two subs, it seems to RE-lock the cells I have set as 'UNLOCKED'.
Subs in module:
Code:
Sub unlocksheet()
'call unlocksheet from any page of code to unprotect activesheet
ActiveSheet.Unprotect Password:="tfi1355"
End Sub
Sub locksheet()
'call locksheet from any page of code to protect activesheet
ActiveSheet.Protect Password:="tfi1355"
End Sub
Code that seems to be causing the issue:
Code:
Private Sub sh05clear_Click()
Call pre_select_view 'contains its own unlock/lock
Call select_view 'contains its own unlock/lock
Call unlocksheet
'clears existing input
Range("o7").Clear
'clears work order input
Range("o21").Clear
'clears brady input
Range("o35").Clear
'clears quantity input
Range("n47").Clear
'defines selection range as unselected
Range("n50").Value = "unselected"
'clears lot input
Range("n53").Clear
'clears processed range
Range("r47").Value = ""
'clears the tables for brady scans and 2d scans
Range("o10:x10").ClearContents
Range("o38:x38").ClearContents
'sets workoder date selection to todays date
Range("q25").Value = today
Call locksheet
End Sub