Active Hedings without ActiveWindow cmd

Paul Sansom

Board Regular
Joined
Jan 28, 2013
Messages
164
Office Version
2016
Platform
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
 

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,561
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
 

Paul Sansom

Board Regular
Joined
Jan 28, 2013
Messages
164
Office Version
2016
Platform
Windows
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
:(
 

Forum statistics

Threads
1,081,663
Messages
5,360,342
Members
400,581
Latest member
Eskimo

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top