Active Hedings without ActiveWindow cmd

Paul Sansom

Board Regular
Joined
Jan 28, 2013
Messages
178
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Hi

Is there away to display all headings without using Active Window.
The following code works fine but i don't want to open and activate each sheet just to turn on Headings, as this triggers other objects like WS_Actvate etc.

Code:
            For Each ws In Sheets
                ws.Visible = xlSheetVisible
                ws.Activate
                With ActiveWindow
                    .DisplayHeadings = True
                    ' more
                End With
            Next ws

Cheers Paul
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Couldn't you just put that command into each sheet's _Activate event, so that it only fires when the sheet's actually opened?
Code:
Private Sub Worksheet_Activate()
ActiveWindow.DisplayHeadings = True
End Sub
 
Upvote 0
Thanks for suggestion.
the above is within an if as not all sheets have headings n in every state of view...
Plus i still have the problem of how to switch off again when sheet is not active
:(
 
Upvote 0
Plus i still have the problem of how to switch off again when sheet is not active
:(
Just use the sheet's _deactivate event...
Code:
Private Sub Worksheet_Deactivate()
ActiveWindow.DisplayHeadings = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,078
Latest member
skydd

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