Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
ldd
 
Posts: n/a
Default changing tab color conditionally


I have a Workbook that contains several pages. Each page represents a
different style of product. When my customer sends in an order I place
the order quantity in a certain named cell on the corresponding
worksheet. Is there a way that I can format the tab to change color if
the quantity of the named cell is greater than 0?

Thanks in advance.


--
ldd
------------------------------------------------------------------------
ldd's Profile: http://www.excelforum.com/member.php...o&userid=19157
View this thread: http://www.excelforum.com/showthread...hreadid=378510

  #2   Report Post  
MartinShort
 
Posts: n/a
Default


You will need to write a small amount of code as follows:


Code:
--------------------
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Range("A1") 0 Then
ActiveWorkbook.Sheets("Sheet1").Tab.ColorIndex = 50 ' Changes tab colour colour to green
Else
ActiveWorkbook.Sheets("Sheet1").Tab.ColorIndex = 2 'changes tab colour back to white
End If
End Sub
--------------------

Needless to say, replace Range("A1") with whatever you want.
Also the TabColorIndex is your call too.

Place it in the ThisWorkBook Module of visual basic project explorer.
I'm not sure what event you would want to attach it to. Open? Sheet
Change? Sheet Deactivate? I'm sure you'll choose the best one for
your needs.

Let us know if you need any extra help


--
MartinShort

Software Tester
------------------------------------------------------------------------
MartinShort's Profile: http://www.excelforum.com/member.php...o&userid=22034
View this thread: http://www.excelforum.com/showthread...hreadid=378510

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
Automatic changing refrences to sheet corresponding to first day. Firebird Excel Discussion (Misc queries) 16 June 8th 05 10:41 PM
Changing the format of an Excel output file made by Microsoft Access Amir Excel Discussion (Misc queries) 2 May 1st 05 12:57 AM
How do I stop excel automatically changing my date to 2005? zoemcb Excel Discussion (Misc queries) 6 April 30th 05 02:39 AM
changing page break in an excel file ibs81 New Users to Excel 1 April 14th 05 07:03 PM
Quickly Changing Several Series to Appear the Same Barb Reinhardt Charts and Charting in Excel 2 February 7th 05 03:10 PM


All times are GMT +1. The time now is 04:43 PM.

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

About Us

"It's about Microsoft Excel"