whats wrong with vba code keep getting error message

aedctalk

Board Regular
Joined
Oct 9, 2010
Messages
156
I'm trying to hide hide and unhide a row on another sheet "FRI" my checkboxes are on sheet "CONFIG" if i take out the top 2 lines my code hides on the active sheet just fine..

However when trying to hide on sheet "FRI" with top 2 rows in i get.

UNABLE TO GET CHECKBOXES PROPERTY OF WORKSHEET CLASS....

How exactly can i make these rows hide correctly on another sheet? whats wrong :( Thank you

Sheets("FRI").Select
Sheets("FRI").Activate
ActiveSheet.Unprotect
Dim cb As Excel.CheckBox

Set cb = Excel.ActiveSheet.CheckBoxes(Application.Caller)
If cb.Value = xlOn Then
Rows("80:88").EntireRow.Hidden = False
Else
Rows("80:88").EntireRow.Hidden = True
End If
ActiveSheet.Protect

End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Perhaps you could try something like this:

Code:
[COLOR=red][B]Sheets("FRI").Unprotect
[/B][/COLOR]
Dim cb As Excel.CheckBox

Set cb = Excel.ActiveSheet.CheckBoxes(Application.Caller)
If cb.Value = xlOn Then
[COLOR=red][B]Sheets("FRI").[/B][/COLOR]Rows("80:88").EntireRow.Hidden = False
Else
[COLOR=red][B]Sheets("FRI").[/B][/COLOR]Rows("80:88").EntireRow.Hidden = True
End If
[B][COLOR=red]Sheets("FRI").Protect
[/COLOR][/B]
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,740
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top