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
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
35,705
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
35,705
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
35,705
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
35,705
Office Version
365
Platform
Windows
Does the code I suggested do what you need?
 

Fluff

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

Forum statistics

Threads
1,089,619
Messages
5,409,370
Members
403,260
Latest member
ssauk

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top