Sheet

Home Search Site Map

Up
AutoFormat...
Cells...
Column
Conditional Formatting...
Row
Sheet
Style...

New! Excel User Group Now Open @ www.excelusergroup.org, Check It Out!


Menu command Type What happens next?
Sheet Sets the sheet formatting through the sub menu below.

Rename allows you to rename the tab at the bottom of the sheet. This can equally be achieved by double-clicking on the sheet tab. No two worksheets can have the same name and the names cannot contain illegal characters like */\:[]? etc. and they must contain less than 32 characters.  Equally you cannot leave them blank.

Hide will hide the sheet(s) selected. (To select more than one sheet click on a sheet tab and then either hold the Crtl key down and click on non-contiguous sheet tabs or, hold the Shift key down and click on the last of a contiguous range of sheet tabs. You are now in 'Group' mode, (as shown in Excel's title bar) and anything you do on one sheet will also happen on the others in the group. To unselect sheets, click on a tab for a sheet not in the group or, right-click on a sheet tab and select 'ungroup').

These sheets can be unhidden by taking the Unhide... option below, which is only available if there are hidden sheets in the workbook. VBA provides a special type of hidden constant, (xlSheetVeryHidden), which when used will not show the hidden sheet in the user interface, the dialog below or the sheet list obtained from right clicking on the sheet navigation buttons at the bottom left of the Excel window. In this state, they can only be unhidden in code.  This is useful for storing hidden values, tables, etc for use in other parts of a model.

Unhide presents the dialog shown above with a list of hidden sheets, (unless they have been hidden in code using xlSheetVeryHidden).

Background allows you to select a background to your worksheets, such as a watermark, company logo, etc. The image is selected from a standard open file dialog box and is displayed 'tiled' across the entire worksheet. These cannot be printed when inserted as a background.

Tab Color... is only available from Excel versions from XP (2002) up, before this the feature is not available. The option supplies this tab formatting dialog to select colours for the tabs. These are shown as solid colours when the tab is not selected, and as a single line of colour at the base of the tab when selected. (As below).

 

 

VBA Sub FormatSheet()
Dim wks1 As Worksheet
Dim wks2 As Worksheet
'assign activesheet to wks2 variable
Set wks1 = ActiveSheet
'adds a new sheet assigned to wks2 variable
Set wks2 = Worksheets.Add
'Sets the tab colour of the activesheet to red,
'renames it TestSheet and sets a background picture
With wks1
.Tab.Color = RGB(255, 0, 0)
.Name = "TestSheet"
.SetBackgroundPicture ("C:\MyImage.jpg")
End With
'Hides the new sheet from the user interface and renames it
With wks2
.Visible = xlSheetVeryHidden
.Name = "Very Hidden Sheet"
End With
End Sub

Top

Copyright Nick Hodge 2008. All Rights Reserved.