Sheet change code

G

Gordon

Hi.

I'm using excel 2003. When I open my workbook I have an auto_open routine
that strips out all excel features such as row and column headings etc.
However, Excel seems to have a mind of its own and when I click on sheet tabs
to change sheet I see that the row and heading columns have reapered. Is
there any code out there that will strip out what I want just by clicking the
sheet tab.

Thanks in advance.

Gordon
 
J

Jim Thomlinson

Row and column headings is a window setting, not a application level setting.
That means that you need to set it for each window as you go there. Place
this code in Thisworkbook and you should be good to go...

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
ActiveWindow.DisplayHeadings = False
End Sub
 
N

NickH

Hi Gordon,

How about something like this...

Private Sub Workbook_Open()
Dim wks As Worksheet

For Each wks In ThisWorkbook.Worksheets
If wks.Visible Then
wks.Activate
With ActiveWindow
.DisplayHeadings = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
End With
End If
Next wks
End Sub

HTH,
NickH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top