Hide headings in all worksheets

JasonBing

New Member
Joined
Aug 6, 2019
Messages
49
No doubt this has been covered before

is there a VBA to hide the headings in all worksheets

Thanks everyone

Regards

Jason Bing
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
How about
Code:
Sub JasonBing()
   Sheets.Select
   ActiveWindow.DisplayHeadings = False
End Sub
 
Upvote 0
This works great in the test book, thank you

However the sheets are all protected in the master database

What do I have to add to the code to unprotect the sheets then protect after

Thanks

Jason Bing
 
Upvote 0
There shouldn't be any need to unprotect the sheets
 
Upvote 0
Thanks for the reply. I am getting a Run-Time error 1004

Unprotected method of worksheet class failed. this is in another unrelated macro in a different module. It is appearing in the


Code:
ActiveSheet.unprotect ""


I have disabled all parts of the sub and it is the sheets.select that is causing the error

If I manually select all the sheet tabs and hide headings. it works fine

:confused:

Thanks for the help

Jason Bing
 
Upvote 0
You don't need to unprotect sheets in order to hide the headings, so just get rid of that line.
 
Upvote 0
I don’t have this line in that macro. I appears to be all the other macros with this line in it. Something about some of the other macros with

Activesheets.unprotect “” in them.

I can select all the sheets manually just fine, but when I do it via vba, even sheets.select in its own macro, I get the error, in random codes containing

Activesheets.unprotect “”
Or
Activesheets.protect “”

This function is not critical just handy but if you have Any ideas I’m keen to learn. Is this a topic for a new thread?

Regards

Jason Bing
 
Upvote 0
Does the code I suggested do what you need?
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,203
Members
452,617
Latest member
Narendra Babu D

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