VBA retrieve sheet tab color value

nodent

New Member
Joined
Jan 13, 2016
Messages
9
Hello,
I'm creating a front end navigation sheet to point to other sheets within the workbook.

I want to retrieve the sheet tab color then fill a cell to match that color.

Thank you
Shannon
 
Last edited:

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
How about
Code:
Sub ShtTabColour()

   Dim Ws As Worksheet
   Dim Cnt As Long
   
   For Each Ws In Worksheets
      Cnt = Cnt + 1
      With Sheets("[COLOR=#ff0000]Sheet1[/COLOR]").Range("A" & Cnt)
         If Not Ws.Tab.Color = False Then .Interior.Color = Ws.Tab.Color
         .Value = Ws.Name
      End With
   Next Ws
      
End Sub
This will put the sheet name & tab colour in col A of a sheet called Sheet1
 
Upvote 0
How about
Code:
Sub ShtTabColour()

   Dim Ws As Worksheet
   Dim Cnt As Long
   
   For Each Ws In Worksheets
      Cnt = Cnt + 1
      With Sheets("[COLOR=#ff0000]Sheet1[/COLOR]").Range("A" & Cnt)
         If Not Ws.Tab.Color = False Then .Interior.Color = Ws.Tab.Color
         .Value = Ws.Name
      End With
   Next Ws
      
End Sub
This will put the sheet name & tab colour in col A of a sheet called Sheet1

Thank you so much, I was able to get mine to work with your insight :)
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,895
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top