VB crashes when worksheet is hidden or protected

FiservEFTSalesOps

New Member
Joined
Dec 7, 2009
Messages
31
Hello fellow posters (It's been a very long time since my last post)

I've put together a dashboard in Excel 2010 that has several worksheets and some beginner VB code. One of the worksheets ("Control") drives many of the dashboard actions. The VB also references this worksheet. I don't want users to change anything on the "Control" sheet, however when I hide it or protect it, it breaks the VB. For you experienced VB'ers, this is probably easy. I've worked long and hard on thsi dashboard and this is the last piece of the puzzle.

Thanks in advance for any help.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hello fellow posters (It's been a very long time since my last post)

I've put together a dashboard in Excel 2010 that has several worksheets and some beginner VB code. One of the worksheets ("Control") drives many of the dashboard actions. The VB also references this worksheet. I don't want users to change anything on the "Control" sheet, however when I hide it or protect it, it breaks the VB. For you experienced VB'ers, this is probably easy. I've worked long and hard on thsi dashboard and this is the last piece of the puzzle.

Thanks in advance for any help.

I am not familiar with the error message "VB Broken". However, I do know that if you try to make a change on a protected worksheet using VBA, it will most likely throw an error. You first have to unportect the sheet, do your bit, then re-protect the sheet. I imagine the same is true with the hidden sheet for the most part, although I have seen some code that referred to a value on a hidden sheet that did not produce an error. It is easy enough to resolve. If it produces the error, unhide or unprotect as the case may be, then re-hide and re-protect.
 
Upvote 0
Based on feedback I inserted this into by VB and it works great. Thanks all.

With Sheets(name)
.Visible = True
' code here
.Visible = false
End with
 
Upvote 0

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

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