ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet change code (https://www.excelbanter.com/excel-programming/360496-sheet-change-code.html)

Gordon[_2_]

Sheet change code
 
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

Jim Thomlinson

Sheet change code
 
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

--
HTH...

Jim Thomlinson


"Gordon" wrote:

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


NickH

Sheet change code
 
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



All times are GMT +1. The time now is 02:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com