3ddesignbros
New Member
- Joined
- Apr 30, 2022
- Messages
- 9
- Office Version
- 2021
- Platform
- Windows
Hello, so I have a VBA on a dashboard of sorts sheet that contains a bunch of checkboxes that when checked unhide rows on another sheet. The code I'm using for this:
Private Sub CheckBox6_Click()
ThisWorkbook.Sheets("Filament Data Sheet").Rows("3:14").EntireRow.Hidden = Not CheckBox6
End Sub
The code above works great, with no issues. The box is checked and the rows are there. The box is unchecked and the rows are gone.
I'm now finalizing this workbook and need to protect all the sheets. However, now that the sheets are protected the checkbox cannot hide the rows in the other sheets. I've tried a ton of different codes and I can't seem to get anything to work. I'm pretty new to VBA so I'm guessing I'm missing something simple but I just can't figure it out. Below are some of the things I've tried:
Private Sub CheckBox6_Click()
ThisWorkbook.Sheets("Filament Data Sheet").Unprotect Password = "Password"
ThisWorkbook.Sheets("Filament Data Sheet").Rows("3:14").EntireRow.Hidden = Not CheckBox6
ThisWorkbook.Sheets("Filament Data Sheet").Protect Password = "password"
End Sub
The above didn't work
I tried creating the following subs:
Sub unprotect1()
ThisWorkbook.Sheets("Filament Data Sheet").unprotect "password"
End Sub
Sub protect1()
ThisWorkbook.Sheets("Filament Data Sheet").protect "password"
End Sub
Then added the protect1 and unprotect1 as follows:
Private Sub CheckBox6_Click()
unprotect1
ThisWorkbook.Sheets("Filament Data Sheet").Rows("3:14").EntireRow.Hidden = Not CheckBox6
protect1
End Sub
The above didn't work
I tried this following code:
Private Sub ChecBox6_Click()
With Sheets("Filament Data Sheet")
.Unprotect Password:="Password"
.Rows("3:14").EntireRow.Hidden = CheckBox6.Value
.Protect Password:="Password"
End With
End Sub
The above didn't work
Feels like I've tried 6 other things as well with no luck.
The best outcome I've gotten is the sheet becomes unprotected, but then I get an error hiding the rows.
Would be super appreciative of the help. Thanks
Private Sub CheckBox6_Click()
ThisWorkbook.Sheets("Filament Data Sheet").Rows("3:14").EntireRow.Hidden = Not CheckBox6
End Sub
The code above works great, with no issues. The box is checked and the rows are there. The box is unchecked and the rows are gone.
I'm now finalizing this workbook and need to protect all the sheets. However, now that the sheets are protected the checkbox cannot hide the rows in the other sheets. I've tried a ton of different codes and I can't seem to get anything to work. I'm pretty new to VBA so I'm guessing I'm missing something simple but I just can't figure it out. Below are some of the things I've tried:
Private Sub CheckBox6_Click()
ThisWorkbook.Sheets("Filament Data Sheet").Unprotect Password = "Password"
ThisWorkbook.Sheets("Filament Data Sheet").Rows("3:14").EntireRow.Hidden = Not CheckBox6
ThisWorkbook.Sheets("Filament Data Sheet").Protect Password = "password"
End Sub
The above didn't work
I tried creating the following subs:
Sub unprotect1()
ThisWorkbook.Sheets("Filament Data Sheet").unprotect "password"
End Sub
Sub protect1()
ThisWorkbook.Sheets("Filament Data Sheet").protect "password"
End Sub
Then added the protect1 and unprotect1 as follows:
Private Sub CheckBox6_Click()
unprotect1
ThisWorkbook.Sheets("Filament Data Sheet").Rows("3:14").EntireRow.Hidden = Not CheckBox6
protect1
End Sub
The above didn't work
I tried this following code:
Private Sub ChecBox6_Click()
With Sheets("Filament Data Sheet")
.Unprotect Password:="Password"
.Rows("3:14").EntireRow.Hidden = CheckBox6.Value
.Protect Password:="Password"
End With
End Sub
The above didn't work
Feels like I've tried 6 other things as well with no luck.
The best outcome I've gotten is the sheet becomes unprotected, but then I get an error hiding the rows.
Would be super appreciative of the help. Thanks