Since the color numbers are different for the different versions of Excel (Excel 2007 uses some wierd shades) You'll have to record a macro to find your color numbers. this macro will get you started. you need to work on the logic for what you want to do, since what you describe doesn't really make sense...
"how can i write a macro that colors sheet tab into "red" if: 1) sheet contains "zero" string 2) sheet contains "nine" string "if 1) didn't turn it red, it will now 3) sheet contains "nine" AND "zero" strings 'would've been red if 1) or 2) anyway 4) sheet contains "nine" OR "zero" strings 'would've been red if 1) or 2) anyway '------------------------------------------------------------------------- Sub colorTab() Dim sh On Error Resume Next Application.ScreenUpdating = False For Each sh In Worksheets Sheets(sh.Name).Select Range("A1").Select Sheets(sh.Name).Tab.Color = 32768 'Color ' Err.Clear Cells.Find(What:="zero", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Activate If Err.Number <> 0 Then Sheets(sh.Name).Tab.Color = 13311 'Red End If Cells.Find(What:="nine", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Activate If Err.Number <> 0 Then Sheets(sh.Name).Tab.Color = 13311 'Red End If Next sh On Error GoTo 0 Application.ScreenUpdating = True End Sub Paul ________________________________ From: Mehdi_21 <meh.i...@gmail.com> To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com> Sent: Friday, May 22, 2009 5:02:45 AM Subject: $$Excel-Macros$$ Coloring sheet tab conditionnally hey everyone, how can i write a macro that colors sheet tab into "red" if: 1) sheet contains "zero" string 2) sheet contains "nine" string 3) sheet contains "nine" AND "zero" strings 4) sheet contains "nine" OR "zero" strings otherwise sheet tab color turns into "Green" thanks in advance for your help regards --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---