+ Reply to Thread
Results 1 to 2 of 2

Colour Worksheet Tabs in Excel 2000

  1. #1
    Valued Forum Contributor
    Join Date
    09-23-2005
    Location
    Bristol, UK
    MS-Off Ver
    2007
    Posts
    664

    Colour Worksheet Tabs in Excel 2000

    Hi all,

    Does anyone know if there's a means of changing the colour of the worksheet tabs in Excel 2000? I believe 2002 has an option to do this by right-clicking and selecting a 'Tab Color' option, but there's no such option in 2000.

    Perhaps there's some VBA that could do it?

    And ideas?

    TIA,

    SamuelT

  2. #2
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363
    Hi Samuel

    This is not my code. I can remember where I took it, have fun
    Sub ChangeTab_Colour()
    Dim Kolor As Long
    Dim CurKolor As Long
    Dim R As Integer, G As Integer, B As Integer

    '// Initialize random-number generator.
    Randomize
    '// Generate random value between 0 and 255.
    R = Int(255 * Rnd)
    G = Int(255 * Rnd)
    B = Int(255 * Rnd)

    '// Try these if you want Basic Colours
    '// ===============================================
    '// Black 0 0 0 || Blue 0 0 255
    '// Green 0 255 0 || Cyan 0 255 255
    '// Red 255 0 0 || Magenta 255 0 255
    '// Yellow 255 255 0 || White 255 255 255
    '// ===============================================
    CurKolor = GetSysColor(COLOR_WINDOW)

    With Application
    .ScreenUpdating = False
    '// color it Randomly
    Kolor = SetSysColors(1, COLOR_WINDOW, RGB(R, G, B))
    ShSet
    .ScreenUpdating = True
    MsgBox "Tab colour has changed!", vbInformation + vbSystemModal, _
    "Tab Colour Hack "
    .ScreenUpdating = False
    ShReset
    '// Restore to Default
    Kolor = SetSysColors(1, COLOR_WINDOW, CurKolor)
    .ScreenUpdating = True
    End With

    End Sub

    Sub ShSet()
    Dim x As Double

    Cells.Select
    With Selection
    .Interior.ColorIndex = 2
    .Interior.Pattern = xlSolid
    .Borders(xlDiagonalDown).LineStyle = xlNone
    .Borders(xlDiagonalUp).LineStyle = xlNone
    End With
    For x = 7 To 12
    With Selection.Borders(x)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = 15
    End With
    Next
    [A1].Select
    End Sub

    Sub ShReset()
    Cells.Select
    With Selection
    .Borders(xlDiagonalDown).LineStyle = xlNone
    .Borders(xlDiagonalUp).LineStyle = xlNone
    .Borders(xlEdgeLeft).LineStyle = xlNone
    .Borders(xlEdgeTop).LineStyle = xlNone
    .Borders(xlEdgeBottom).LineStyle = xlNone
    .Borders(xlEdgeRight).LineStyle = xlNone
    .Borders(xlInsideVertical).LineStyle = xlNone
    .Borders(xlInsideHorizontal).LineStyle = xlNone
    .Interior.ColorIndex = xlNone
    End With
    [A1].Select
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1