Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to check the colour of a worksheet tab through code? if yes
how? I have red tabs and green tabs and want to create a summary sheet of only the red sheets Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi AliH,
Try: '============================ Public Sub TesterAAA() Dim i As Long For i = 1 To ActiveWorkbook.Worksheets.Count If Worksheets(i).Tab.ColorIndex = 3 Then 'Red Sheets("YourSummarySheet").Cells(i + 1, "A").Value _ = Worksheets(i).Name End If Next i End Sub '<<============================ Change the sheet name to suit. --- Regards, Norman "AliH" wrote in message ... Is it possible to check the colour of a worksheet tab through code? if yes how? I have red tabs and green tabs and want to create a summary sheet of only the red sheets Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub showcolornumbers()
For i = 1 To 56 Cells(i, 1).Value = i Cells(i, 2).Interior.ColorIndex = i Next End Sub would show you the colors available in your workbook. -- Regards, Tom Ogilvy "AliH" wrote in message ... Thanks - where did you get the color numbers from? that was what I was looking for? "Norman Jones" wrote in message ... Hi AliH, Try: '============================ Public Sub TesterAAA() Dim i As Long For i = 1 To ActiveWorkbook.Worksheets.Count If Worksheets(i).Tab.ColorIndex = 3 Then 'Red Sheets("YourSummarySheet").Cells(i + 1, "A").Value _ = Worksheets(i).Name End If Next i End Sub '<<============================ Change the sheet name to suit. --- Regards, Norman "AliH" wrote in message ... Is it possible to check the colour of a worksheet tab through code? if yes how? I have red tabs and green tabs and want to create a summary sheet of only the red sheets Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi AliH,
See ColorIndex Property in VBA help for a list for the default color palette. --- Regards, Norman "AliH" wrote in message ... Thanks - where did you get the color numbers from? that was what I was looking for? "Norman Jones" wrote in message ... Hi AliH, Try: '============================ Public Sub TesterAAA() Dim i As Long For i = 1 To ActiveWorkbook.Worksheets.Count If Worksheets(i).Tab.ColorIndex = 3 Then 'Red Sheets("YourSummarySheet").Cells(i + 1, "A").Value _ = Worksheets(i).Name End If Next i End Sub '<<============================ Change the sheet name to suit. --- Regards, Norman "AliH" wrote in message ... Is it possible to check the colour of a worksheet tab through code? if yes how? I have red tabs and green tabs and want to create a summary sheet of only the red sheets Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks - where did you get the color numbers from? that was what I was
looking for? "Norman Jones" wrote in message ... Hi AliH, Try: '============================ Public Sub TesterAAA() Dim i As Long For i = 1 To ActiveWorkbook.Worksheets.Count If Worksheets(i).Tab.ColorIndex = 3 Then 'Red Sheets("YourSummarySheet").Cells(i + 1, "A").Value _ = Worksheets(i).Name End If Next i End Sub '<<============================ Change the sheet name to suit. --- Regards, Norman "AliH" wrote in message ... Is it possible to check the colour of a worksheet tab through code? if yes how? I have red tabs and green tabs and want to create a summary sheet of only the red sheets Thanks |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would just add to Tom and Norman's replies that the color assigned to a
Colorindex is customizable under Tools, Options, Color. So it's not necessarily a fixed thing. I.e., 3 is not always red, it can be any color assigned to it. -- Jim "AliH" wrote in message ... | Thanks - where did you get the color numbers from? that was what I was | looking for? | | "Norman Jones" wrote in message | ... | Hi AliH, | | Try: | | '============================ | Public Sub TesterAAA() | | Dim i As Long | | For i = 1 To ActiveWorkbook.Worksheets.Count | If Worksheets(i).Tab.ColorIndex = 3 Then 'Red | Sheets("YourSummarySheet").Cells(i + 1, "A").Value _ | = Worksheets(i).Name | End If | Next i | | End Sub | '<<============================ | | Change the sheet name to suit. | | --- | Regards, | Norman | | | | "AliH" wrote in message | ... | Is it possible to check the colour of a worksheet tab through code? if | yes | how? | | I have red tabs and green tabs and want to create a summary sheet of | only | the red sheets | | Thanks | | | | | | |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To add to Jim's excellent information, David McRitchie has a detailed page
on this topic: http://www.mvps.org/dmcritchie/excel/colors.htm -- Regards, Tom Ogilvy "Jim Rech" wrote in message ... I would just add to Tom and Norman's replies that the color assigned to a Colorindex is customizable under Tools, Options, Color. So it's not necessarily a fixed thing. I.e., 3 is not always red, it can be any color assigned to it. -- Jim "AliH" wrote in message ... | Thanks - where did you get the color numbers from? that was what I was | looking for? | | "Norman Jones" wrote in message | ... | Hi AliH, | | Try: | | '============================ | Public Sub TesterAAA() | | Dim i As Long | | For i = 1 To ActiveWorkbook.Worksheets.Count | If Worksheets(i).Tab.ColorIndex = 3 Then 'Red | Sheets("YourSummarySheet").Cells(i + 1, "A").Value _ | = Worksheets(i).Name | End If | Next i | | End Sub | '<<============================ | | Change the sheet name to suit. | | --- | Regards, | Norman | | | | "AliH" wrote in message | ... | Is it possible to check the colour of a worksheet tab through code? if | yes | how? | | I have red tabs and green tabs and want to create a summary sheet of | only | the red sheets | | Thanks | | | | | | |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
worksheet will not print in color | Excel Discussion (Misc queries) | |||
CANNOT COLOR MY WORKSHEET TABS, TAB COLOR NOT IN FORMAT | Excel Worksheet Functions | |||
3 pg worksheet prints all pgs in color, but only 2 pgs in b&w? | Excel Discussion (Misc queries) | |||
worksheet background color | Excel Discussion (Misc queries) | |||
fill row color on a specified worksheet | Excel Programming |