+ Reply to Thread
Results 1 to 6 of 6

Formula/VBA to enter worksheet/tab color as a value in a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    12-06-2011
    Location
    Cincinnati, OH
    MS-Off Ver
    Excel 2007
    Posts
    13

    Formula/VBA to enter worksheet/tab color as a value in a cell

    I would like to be able to return the color of each worksheet/tab as a value in a cell on each worksheet.

    Example:

    "Sheet 1" - is colored green - Cell "P1" of this worksheet should say green or the excel value of that color
    "Sheet 2" - is colored red - Cell "P1" of this worksheet should say red or the excel value of that color
    "Sheet 3" - is colored blue - Cell "P1" of this worksheet should say blue or the excel value of that color

    Not sure if this is even possible but thought I would ask the experts and see.

    Thanks!

  2. #2
    Forum Contributor ragavan.sridar1's Avatar
    Join Date
    11-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010, Excel 2003
    Posts
    208

    Re: Formula/VBA to enter worksheet/tab color as a value in a cell

    use this code with the color value in required cell.

    Sub Macro1()
    '
    
    
    '
    Dim ws As Worksheet
    
    For Each ws In ActiveWorkbook.Worksheets
    
    ws.Select
        With ActiveWorkbook.ActiveSheet.Tab
            .Color = ActiveSheet.Range("A1").Value
            .TintAndShade = 0
        End With
        Range("B32").Select
    
    Next ws
    
    End Sub
    The color codes should be like this "5296274"
    Thanks!
    Raga.

    Please,mark your thread [SOLVED] if you received your answer.

    Click the little star * below, to give some Rep if you think an answer deserves it.

    I learnt so many things from these links.

  3. #3
    Registered User
    Join Date
    12-06-2011
    Location
    Cincinnati, OH
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Formula/VBA to enter worksheet/tab color as a value in a cell

    I'm not following what that is doing?

  4. #4
    Registered User
    Join Date
    12-06-2011
    Location
    Cincinnati, OH
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Formula/VBA to enter worksheet/tab color as a value in a cell

    That's not working and I'm not following what it is trying to do?

  5. #5
    Registered User
    Join Date
    12-06-2011
    Location
    Cincinnati, OH
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Formula/VBA to enter worksheet/tab color as a value in a cell

    This isn't doing what I was wanting.

  6. #6
    Forum Contributor ragavan.sridar1's Avatar
    Join Date
    11-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010, Excel 2003
    Posts
    208

    Re: Formula/VBA to enter worksheet/tab color as a value in a cell

    Sorry..

    I understood this wrong..

    Try this code.

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    
    '
    Dim ws As Worksheet
    
    For Each ws In ActiveWorkbook.Worksheets
    
    ws.Select
        Range("P1").Value = ActiveSheet.Tab.Color
        
        
        
    
    Next ws
    
    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