Class Tab (Excel VBA)

The class Tab represents the tab of a chart or a worksheet.

Color

Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value.

Charts("Chart1").Axes(xlValue).TickLabels.Font.Color = _ 
 RGB(0, 255, 0)

ColorIndex

Returns or sets a value that represents the color of the specified worksheet tab or chart tab.

Possible Values are xlColorIndexAutomatic - Automatic color, xlColorIndexNone - No color.

After a Tab object is returned, you can use the ColorIndex property to determine the settings of a tab for a chart or worksheet. The color is specified as an index value in the current color palette from 1 to 56 or the XlColorIndex value xlColorIndexNone.

Sub CheckTab() 
 
 ' Determine if color index of 1st tab is set to none. 
 If Worksheets(1).Tab.ColorIndex = xlColorIndexNone Then 
  MsgBox "The color index is set to none for the first " & _ 
  "worksheet tab." 
 Else 
  MsgBox "The color index for the tab of the first worksheet " & _ 
  "is not set to none." 
 End If 
 
End Sub

Parent

Returns the parent object for the specified object. Read-only.

ThemeColor

Returns or sets the theme color in the applied color scheme that is associated with the specified object.

Possible Values are xlThemeColorAccent1 - Accent1, xlThemeColorAccent2 - Accent2, xlThemeColorAccent3 - Accent3, xlThemeColorAccent4 - Accent4, xlThemeColorAccent5 - Accent5, xlThemeColorAccent6 - Accent6, xlThemeColorDark1 - Dark1, xlThemeColorDark2 - Dark2, xlThemeColorFollowedHyperlink - Followed hyperlink, xlThemeColorHyperlink - Hyperlink, xlThemeColorLight1 - Light1, xlThemeColorLight2 - Light2.

Attempting to access a theme color for an object whose color is not currently themed will result in an invalid request run-time error.

TintAndShade

Returns or sets a Single that lightens or darkens a color.

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral. Attempting to set this property to a value less than -1 or more than 1 is not recommended. Excel will correct the value internally to some value that falls within the range of valid values. This property works for both theme colors and nontheme colors.