Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Greetings, I secured/protected my worksheets/workbook, but when I I do I cannot use my macro buttons I created with shapes, and I get an error which links to the code below. The code works good as long as I do not protect the sheet. The VBA Code that won't work is:
I'm sure coming up with a code to use the above macro is necessary .
The second part of my question is coming up with a macro so I can use my buttons while the sheet is protect. Am I to use something like?
Then for each macro that uses a command button do I insert
at the beginning and end of the macros.
I'm asking these two now, since I cannot do anything until the first macro is sorted.
Thank you,
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("O3:O500").Value = Range("C3:C500").Value
End Sub
I'm sure coming up with a code to use the above macro is necessary .
The second part of my question is coming up with a macro so I can use my buttons while the sheet is protect. Am I to use something like?
VBA Code:
Sub SheetProtection()
'Checks if the Training sheet:
' - If it is PROTECTED ... then UNPROTECT it
' - If it is UNPROTECTED ... then PROTECT it
If ThisWorkbook.Sheets("Xman").ProtectContents = True Then
ThisWorkbook.Sheets("Xman").Unprotect "mozzer"
Else
ThisWorkbook.Sheets("Xman").protect "mozzer"
End If
End Sub
Then for each macro that uses a command button do I insert
VBA Code:
Call SheetProtection
I'm asking these two now, since I cannot do anything until the first macro is sorted.
Thank you,