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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
59,920
Office Version
  1. 365
Platform
  1. 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
59,920
Office Version
  1. 365
Platform
  1. Windows
There shouldn't be any need to unprotect the sheets
 

JasonBing

New Member
Joined
Aug 6, 2019
Messages
49

ADVERTISEMENT

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
59,920
Office Version
  1. 365
Platform
  1. 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

ADVERTISEMENT

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

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
59,920
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,136,314
Messages
5,675,032
Members
419,544
Latest member
MVPDoug

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
Top