Purple Turtle
New Member
- Joined
- Aug 2, 2020
- Messages
- 15
- Office Version
- 365
- Platform
- Windows
On sheet 1, there is an active x command button that when clicked it will clear contents from 12 other sheets in the workbook but not sheet1.
There will be specific ranges for example "D:13,D20" , "J:13,J25", etc. All of the sheets including sheet1 are password protected.
I tried this code but it didn't work.
Private Sub CommandButton_Click()
Sheets("Sheet1", "Sheet2", "Sheet3","Sheet4","Sheet5","Sheet6","Sheet7","Sheet8","Sheet9","Sheet10","Sheet11","Sheet12").Unprotect "password"
Sheets("Sheet2", "Sheet3","Sheet4","Sheet5","Sheet6","Sheet7","Sheet8","Sheet9","Sheet10","Sheet11","Sheet12").Range("D13:D20" , "J:13,J25").clearcontents
Sheets("Sheet1" "Sheet2", "Sheet3","Sheet4","Sheet5","Sheet6","Sheet7","Sheet8","Sheet9","Sheet10","Sheet11","Sheet12").Protect "password"
End Sub
I've searched on how to accomplish this but still having trouble. Any help would be appreciated.
There will be specific ranges for example "D:13,D20" , "J:13,J25", etc. All of the sheets including sheet1 are password protected.
I tried this code but it didn't work.
Private Sub CommandButton_Click()
Sheets("Sheet1", "Sheet2", "Sheet3","Sheet4","Sheet5","Sheet6","Sheet7","Sheet8","Sheet9","Sheet10","Sheet11","Sheet12").Unprotect "password"
Sheets("Sheet2", "Sheet3","Sheet4","Sheet5","Sheet6","Sheet7","Sheet8","Sheet9","Sheet10","Sheet11","Sheet12").Range("D13:D20" , "J:13,J25").clearcontents
Sheets("Sheet1" "Sheet2", "Sheet3","Sheet4","Sheet5","Sheet6","Sheet7","Sheet8","Sheet9","Sheet10","Sheet11","Sheet12").Protect "password"
End Sub
I've searched on how to accomplish this but still having trouble. Any help would be appreciated.