Search code examples
excelms-office

How to Freeze sheets in Excel


I am facing a problem in my excel workbook. I have 25+ sheets in my workbook and I want to look to sheet1 time to time. Is their any way that I can freeze first two sheets of my workbook?

Currently I am navigating through sheets by pressing ctrl+page up button. FYI I am Using MS-Office 2007


Solution

  • If I have understood well: you want the users stay only on Sheet1 & 2:
    In the Main event:

    Private Sub Workbook_Open()
        ActiveWindow.DisplayWorkbookTabs = False
    End Sub
    

    and in the Event:

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
        If ActiveWindow.DisplayWorkbookTabs Then ActiveWindow.DisplayWorkbookTabs = False
        If ((Sh.Name) <> "Sheet1") And ((Sh.Name) <> "Sheet2") Then Sheets("Sheet1").Select
    End Sub
    

    When open disable Tabs. If people show if you try to change the code return to Sheet1.
    Ad Password to VBA macro ...
    If is only for quick change remove the code of Tabs...