Welcome toExcel.Tips.Net
Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Learn Access Now
Free Printable Forms
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site
Filtering Columns for Unique Values
Printing Multiple Worksheets on a Single Page
Jonathan has a workbook that contains over fifty worksheets, one of which is named "Main" and is positioned as the first tab in the workbook. He is constantly having to revert back to the "Main" worksheet. In order to display the worksheet he must either click back a tab at a time or scroll all the way to the left of the tabs (by clicking on the control at the far left of the tabs) and then select the "Main" tab. This last method is the easiest, but still is time consuming. Jonathan wonders if there is a way, much like freezing a pane, to freeze a worksheet tab. He would like the "Main" tab to always be visible, and the tabs to its right to scroll.
The short answer is no, there is not a way in Excel to freeze the worksheet tabs. That being said, there are several things you can do to get the results you want.
One possible solution is to use hyperlinks in your worksheets. Many people set up a system where their main worksheet functions as a table of contents to the other worksheets in the workbook. Each worksheet is hyperlinked from the main worksheet, and each non-main worksheet has a hyperlink back to the main worksheet. Thus they can navigate very quickly between the main and secondary worksheets just by clicking the hyperlinks.
Another option is to remember that you can right-click on the worksheet tab controls at the left of the tabs at the bottom of the Excel window. When you do, you get a list of the first fifteen worksheet names, and you can easily select the "Main" worksheet.
Still another option is to set up a very simple macro that always displays the "Main" worksheet:
Sub GoToMain()
Sheets("Main").Select
End Sub
You can assign this macro to either a shortcut key or a toolbar button (in Excel 2007 you would assign it to the Quick Access toolbar) so that you could use it very quickly. When run, the worksheet named "Main" is always displayed.
If you absolutely want to always have the "Main" sheet visible in the tabs area, then you must resort to a macro that will continuously reorder the tabs so that "Main" is always visible.
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim sc As Long ' count of sheets
Dim NewPos As Long ' index of serlected sheet
Application.EnableEvents = False
Application.ScreenUpdating = False
sc = Sheets.Count
NewPos = ActiveSheet.Index
For i = 2 To NewPos - 1
Sheets(2).Move After:=Sheets(sc)
Next i
Sheets(1).Activate
Sheets(2).Activate
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
This macro needs to be part of the ThisWorkbook object, so make sure you add it into the proper place in the VBA Editor. It always moves the worksheets in positions 2 through however many sheets you have so that the desired worksheet is in the second position. This means that the worksheet in the first position (Main) never moves.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3178) applies to Microsoft Excel versions: 97 2000 2002 2003 2007
More Power! For some people, the prospect of creating macros can be scary. Those who conquer their fears, however, find they become much more confident and productive once they learn how to make Excel do exactly what they want. ExcelTips: The Macros is an invaluable source for learning Excel macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of ExcelTips. Learn at your own pace, exactly the way you want.