Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Conditional tab formatting?
This I saw Bob Phillips' code to automatically name a
worksheet based on a cell in the worksheet (reprinted below). Is there also a code to automatically select the tab color based on a condition in the worksheet. Specifically, if a report is marked "AR" I want the tab red, "CSR" is yellow and Green for "SQ". Also, is there a way to alpha sort the worksheets in a workbook? Thanks for your help. Code to name the woksheet with the value in G1: Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Target.Address = "$G$1" Then Me.Name = Target.Value End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. |
#2
|
|||
|
|||
OK, I found it myself, sort and TOC IS better than color.
http://www.mvps.org/dmcritchie/excel....htm#sortallsh eets -----Original Message----- This I saw Bob Phillips' code to automatically name a worksheet based on a cell in the worksheet (reprinted below). Is there also a code to automatically select the tab color based on a condition in the worksheet. Specifically, if a report is marked "AR" I want the tab red, "CSR" is yellow and Green for "SQ". Also, is there a way to alpha sort the worksheets in a workbook? Thanks for your help. Code to name the woksheet with the value in G1: Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Target.Address = "$G$1" Then Me.Name = Target.Value End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conditional Formatting in Excel Help Please..... | Excel Discussion (Misc queries) | |||
Effect of Conditional Formatting, Data Validation | Excel Discussion (Misc queries) | |||
conditional formatting conflict? | Excel Worksheet Functions | |||
Determine cells that drive conditional formatting? | Excel Discussion (Misc queries) | |||
Conditional formatting not available in Excel | Excel Discussion (Misc queries) |