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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,185
Office Version
365
Platform
Windows
How about
Code:
Sub JasonBing()
   Sheets.Select
   ActiveWindow.DisplayHeadings = False
End Sub
 

JasonBing

New Member
Joined
Aug 6, 2019
Messages
49
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,185
Office Version
365
Platform
Windows
There shouldn't be any need to unprotect the sheets
 

JasonBing

New Member
Joined
Aug 6, 2019
Messages
49
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,185
Office Version
365
Platform
Windows
You don't need to unprotect sheets in order to hide the headings, so just get rid of that line.
 

JasonBing

New Member
Joined
Aug 6, 2019
Messages
49
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,185
Office Version
365
Platform
Windows
Does the code I suggested do what you need?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,185
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,081,936
Messages
5,362,249
Members
400,672
Latest member
ExcelGrasshopper

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top