I am seeking to run various sheets within a protected worksheet / workbook structure. I don't want to have code running within various routine's that continually have to unprotect/protect various worksheets, as this is slowing the use of the workbook down considerably.
Opening the workbook, my code looks like this:
Sheet1.Range("B18").Select
End Sub
As my actual project is large, I simply set about setting up a test workbook with a small range of unlocked cells in sheet1 (range A16:D20), of which B18 is one. I also have a blank sheet2.
This works very well with the exception that there is no 'green border' around the (example only) selected cell B18. If I click anywhere in the unlocked range above after first load, the green cell border doesn't appear.
If I click to sheet 2 and then back to sheet 1, the green border appears, but this isn't the perfect answer to the problem.
This only seems to occur when I run the above protection routine at start up of the workbook. It doesn't occur when protection is run within each workbook separately, although this slows down the workbook considerably so I don't want to do this.
I'm using Office 365 / latest excel.
Computer operating Windows 7 Professional.
I hope I've posted this properly and I would be very grateful for any help you can offer to resolve this matter.
Opening the workbook, my code looks like this:
Private Sub Workbook_Open()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Protect Password:="password", UserInterFaceOnly:=True
wSheet.EnableSelection = xlUnlockedCells
Next wSheet
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Protect Password:="password", UserInterFaceOnly:=True
wSheet.EnableSelection = xlUnlockedCells
Next wSheet
Sheet1.Range("B18").Select
End Sub
As my actual project is large, I simply set about setting up a test workbook with a small range of unlocked cells in sheet1 (range A16:D20), of which B18 is one. I also have a blank sheet2.
This works very well with the exception that there is no 'green border' around the (example only) selected cell B18. If I click anywhere in the unlocked range above after first load, the green cell border doesn't appear.
If I click to sheet 2 and then back to sheet 1, the green border appears, but this isn't the perfect answer to the problem.
This only seems to occur when I run the above protection routine at start up of the workbook. It doesn't occur when protection is run within each workbook separately, although this slows down the workbook considerably so I don't want to do this.
I'm using Office 365 / latest excel.
Computer operating Windows 7 Professional.
I hope I've posted this properly and I would be very grateful for any help you can offer to resolve this matter.