VBA IF function that checks the "hide" state of a sheet

LordVoldetort_IV

New Member
Joined
Jun 10, 2021
Messages
38
Office Version
  1. 365
Platform
  1. Windows
Hello!

Okay so, i want to do some work on a sheet, but i do not want other people to be able to edit it.

I have decided to hide it. Is there any way that i can have a macro in the background check when it is unhidden and give you a propt which, upon deciding yes or no (or perhaps something else), it'll hide the sheet again?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You can use the ".Visible" property, as shown here: VBA - If Sheet is Hidden, Unhide - Else Hide

Note that will not prevent people from unhiding or editing it, especially if they decide not to enable VBA.
So I would not really rely on it as a method to prevent people from seeing/editing certain sheets.
You may want to look into "Very hidden" too. See: How to make Excel worksheet very hidden and unhide it - Ablebits.com

Locking/password protection is much better (though anyone determined enough can break that too - Excel is not known for its security).
 
Upvote 0
Solution
You can use the ".Visible" property, as shown here: VBA - If Sheet is Hidden, Unhide - Else Hide

Note that will not prevent people from unhiding or editing it, especially if they decide not to enable VBA.
So I would not really rely on it as a method to prevent people from seeing/editing certain sheets.
You may want to look into "Very hidden" too. See: How to make Excel worksheet very hidden and unhide it - Ablebits.com

Locking/password protection is much better (though anyone determined enough can break that too - Excel is not known for its security).
Thanks Joe, I appreciate it.
 
Upvote 0
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

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