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
30,569
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
30,569
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
30,569
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
30,569
Office Version
365
Platform
Windows
Does the code I suggested do what you need?
 

Fluff

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

Forum statistics

Threads
1,078,504
Messages
5,340,777
Members
399,395
Latest member
KJAC

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top