Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
BobT
 
Posts: n/a
Default 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   Report Post  
BobT
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting in Excel Help Please..... Willie T Excel Discussion (Misc queries) 4 February 9th 05 02:28 PM
Effect of Conditional Formatting, Data Validation Bill Sturdevant Excel Discussion (Misc queries) 1 January 25th 05 11:50 PM
conditional formatting conflict? Abi Excel Worksheet Functions 2 January 11th 05 03:41 PM
Determine cells that drive conditional formatting? Nicolle K. Excel Discussion (Misc queries) 2 January 7th 05 01:08 AM
Conditional formatting not available in Excel BAB Excel Discussion (Misc queries) 2 January 1st 05 03:33 PM


All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"