Hello,
I am a novice at VBA programming, I have this VBA that I have build through some trial and error and via some web searching. I am trying to format all cells on all sheets (hidden or otherwise) as "Locked" so when the sheets are protected the user can't see the formulas. This macro individually selects every sheet in the book and applys the formatting. Is there a way to modify this code to accomplish the same thing without having it actually select every sheet? The only reason it is an issue is that after running the macro you end up on the last sheet in the book. I don't want it to actually move anyone anywhere and I feel there is probably a more efficient way for this to run.
Thanks!
Sub LockAllCells()
Application.ScreenUpdating = False
Dim wsheet As Worksheet
For Each wsheet In ActiveWorkbook.Sheets
wsheet.Activate
Cells.Locked = True
Cells.FormulaHidden = True
Next wsheet
End Sub
Bookmarks