Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
MaggieMagill
 
Posts: n/a
Default Tab Color from cell value?

Is there a way to change the tab color of a worksheet if a certain cell has
one value or another?

"If cell value is more than zero then tab color is green" type of scenerio?

-Office Pro 2003-
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Maggie,

Sure. Copy the code below, right click on the sheet of interest, select "View Code" and paste the
code in the window that appears. Change the "A3" to the address of the cell that you want to
monitor.

This assumes that the cell is calculated rather than entered manually. If you want to enter a value
into the cell manually, you will need to use the change event - post back if you can't figure it
out.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Calculate()
If Range("A3").Value 0 Then
Range("A3").Parent.Tab.ColorIndex = 4
Else
Range("A3").Parent.Tab.ColorIndex = 3
End If
End Sub

"MaggieMagill" wrote in message news:0N20f.58321$8q.21432@lakeread01...
Is there a way to change the tab color of a worksheet if a certain cell has
one value or another?

"If cell value is more than zero then tab color is green" type of scenerio?

-Office Pro 2003-



  #3   Report Post  
MaggieMagill
 
Posts: n/a
Default

"Bernie Deitrick" <deitbe @ consumer dot org wrote in
:

Subject: Tab Color from cell value?
From: "Bernie Deitrick" <deitbe @ consumer dot org
Newsgroups: microsoft.public.excel.worksheet.functions

Maggie,

Sure. Copy the code below, right click on the sheet of interest,
select "View Code" and paste the code in the window that appears.
Change the "A3" to the address of the cell that you want to monitor.

This assumes that the cell is calculated rather than entered manually.
If you want to enter a value into the cell manually, you will need to
use the change event - post back if you can't figure it out.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Calculate()
If Range("A3").Value 0 Then
Range("A3").Parent.Tab.ColorIndex = 4
Else
Range("A3").Parent.Tab.ColorIndex = 3
End If
End Sub

"MaggieMagill" wrote in message
news:0N20f.58321$8q.21432@lakeread01...
Is there a way to change the tab color of a worksheet if a certain
cell has one value or another?

"If cell value is more than zero then tab color is green" type of
scenerio?

-Office Pro 2003-






Hot diggity! Now THAT is slick!!! I've never played in the world of VB
before (a little Pascal some 15 years ago) but after seeing what THAT can
do for me... Time to hit the VB Help files.

I added an "If" routine for less than zero, changed it so zero or no value
leaves the default tab color with "xlColorIndexNone" and found the color-
index value help file.

All in all - too cool! Thanks a ton!
  #4   Report Post  
David McRitchie
 
Posts: n/a
Default

Incidentally this was the type of posting where the version of Excel
makes a difference and the poster identified her version.

The ability to color worksheet tabs was added in Excel 2002, so
it's not something that everybody can do, though there may be other
solutions for most requests for color worksheet tabs.
http://www.mvps.org/dmcritchie/excel/colors.htm#tabs

"MaggieMagill" wrote in
Hot diggity! Now THAT is slick!!! I've never played in the world of VB
before (a little Pascal some 15 years ago) but after seeing what THAT can
do for me... Time to hit the VB Help files.




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
Input cell reference is not valid (One Variable Data Table) Dottore Excel Worksheet Functions 9 September 1st 05 03:05 PM
Cell color based upon cell value My View Excel Discussion (Misc queries) 11 July 6th 05 03:59 AM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
Cell Change Color - Need Help alani New Users to Excel 3 June 29th 05 03:50 PM
VLookup resulting in a blank cell... KempensBoerke Excel Worksheet Functions 1 October 28th 04 09:57 PM


All times are GMT +1. The time now is 11:05 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"