PC Review


Reply
Thread Tools Rate Thread

Conditional Formatting a tab color

 
 
Rhino V
Guest
Posts: n/a
 
      9th Aug 2009
I know I'm missing something. I'm using Excel 2007 but a 2003 compatible
file for the versatility of my clients. I have a 7 sheet workbook that feeds
data into the first sheet. So as to know which sheets have been modified I'm
trying to use a sequence I found here. Under [View Code] of my tab called
"Replacements" I inserted

Sub Tab_Color()
If Sheets("Replacement").Range("E44").Value > 0 Then
Sheets("Replacement").Tab.ColorIndex = 4
Else
Sheets("Replacement").Tab.ColorIndex = -4142
End If
End Sub

where E44 has a formula for the whole sheet and is the cell that will
determine if the tab should change color or not. I just want to visually see
or be clued "if there's something there" while I'm on any other tab. And for
it to default back if no calculations are done on that sheet.

Using the above sequence doesn't do anything to the tab color when E44
becomes greater than 0 in its calculation. Please help...
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      9th Aug 2009
From workbook launch VBE using Alt+F11. From the treeview on the left right
click VBAProject>(workbookname)>'This Workbook' and hit View Code...On the
code pane paste the below code....

--Assume Replacement!E44 is having a formula...which is referred to the
other sheets...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sheets("Replacement").Range("E44").Value > 0 Then
Sheets("Replacement").Tab.ColorIndex = 4
Else
Sheets("Replacement").Tab.ColorIndex = -4142
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Rhino V" wrote:

> I know I'm missing something. I'm using Excel 2007 but a 2003 compatible
> file for the versatility of my clients. I have a 7 sheet workbook that feeds
> data into the first sheet. So as to know which sheets have been modified I'm
> trying to use a sequence I found here. Under [View Code] of my tab called
> "Replacements" I inserted
>
> Sub Tab_Color()
> If Sheets("Replacement").Range("E44").Value > 0 Then
> Sheets("Replacement").Tab.ColorIndex = 4
> Else
> Sheets("Replacement").Tab.ColorIndex = -4142
> End If
> End Sub
>
> where E44 has a formula for the whole sheet and is the cell that will
> determine if the tab should change color or not. I just want to visually see
> or be clued "if there's something there" while I'm on any other tab. And for
> it to default back if no calculations are done on that sheet.
>
> Using the above sequence doesn't do anything to the tab color when E44
> becomes greater than 0 in its calculation. Please help...

 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      9th Aug 2009
the idea is sound enough. But how will the code be forced? #
You're on some other sheet, so a sheet change or such, probably isn't
needed.
I suggest the the workbook's caluculate event would be good. in the IDE
select ThisWorkbook's code page and paste your code into :

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
If Sheets("Replacement").Range("E44").Value > 0 Then
Sheets("Replacement").Tab.ColorIndex = 4
Else
Sheets("Replacement").Tab.ColorIndex = -4142
End If
End Sub

to test this , i set E44 to point at at cell in sheet1. when is set the
sheet1 cell's value to a positive number , the tab went green.

The con could be that you'd either need calc mode on automatic, so set a
change event to calc the cell in the Replacement sheet.




"Rhino V" <Rhino (E-Mail Removed)> wrote in message
news:37B79AD7-EB7C-4CD3-86AD-(E-Mail Removed)...
> I know I'm missing something. I'm using Excel 2007 but a 2003 compatible
> file for the versatility of my clients. I have a 7 sheet workbook that
> feeds
> data into the first sheet. So as to know which sheets have been modified
> I'm
> trying to use a sequence I found here. Under [View Code] of my tab called
> "Replacements" I inserted
>
> Sub Tab_Color()
> If Sheets("Replacement").Range("E44").Value > 0 Then
> Sheets("Replacement").Tab.ColorIndex = 4
> Else
> Sheets("Replacement").Tab.ColorIndex = -4142
> End If
> End Sub
>
> where E44 has a formula for the whole sheet and is the cell that will
> determine if the tab should change color or not. I just want to visually
> see
> or be clued "if there's something there" while I'm on any other tab. And
> for
> it to default back if no calculations are done on that sheet.
>
> Using the above sequence doesn't do anything to the tab color when E44
> becomes greater than 0 in its calculation. Please help...


 
Reply With Quote
 
Rhino V
Guest
Posts: n/a
 
      9th Aug 2009
It worked! Thank you so much. I was able to replicate "If" statement for
the other 4 tabs, and they behave flawlessly. Your skill and talent is much
appreciated.

"Jacob Skaria" wrote:

> From workbook launch VBE using Alt+F11. From the treeview on the left right
> click VBAProject>(workbookname)>'This Workbook' and hit View Code...On the
> code pane paste the below code....
>
> --Assume Replacement!E44 is having a formula...which is referred to the
> other sheets...
>
> Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
> If Sheets("Replacement").Range("E44").Value > 0 Then
> Sheets("Replacement").Tab.ColorIndex = 4
> Else
> Sheets("Replacement").Tab.ColorIndex = -4142
> End If
> End Sub
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Rhino V" wrote:
>
> > I know I'm missing something. I'm using Excel 2007 but a 2003 compatible
> > file for the versatility of my clients. I have a 7 sheet workbook that feeds
> > data into the first sheet. So as to know which sheets have been modified I'm
> > trying to use a sequence I found here. Under [View Code] of my tab called
> > "Replacements" I inserted
> >
> > Sub Tab_Color()
> > If Sheets("Replacement").Range("E44").Value > 0 Then
> > Sheets("Replacement").Tab.ColorIndex = 4
> > Else
> > Sheets("Replacement").Tab.ColorIndex = -4142
> > End If
> > End Sub
> >
> > where E44 has a formula for the whole sheet and is the cell that will
> > determine if the tab should change color or not. I just want to visually see
> > or be clued "if there's something there" while I'm on any other tab. And for
> > it to default back if no calculations are done on that sheet.
> >
> > Using the above sequence doesn't do anything to the tab color when E44
> > becomes greater than 0 in its calculation. Please help...

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Font Color Conditional Formatting/Color Scaling Ryan Microsoft Excel Worksheet Functions 0 4th Mar 2010 06:03 PM
Using VBA: Conditional Formatting of Row Color tepermanj Microsoft Excel Programming 7 9th Jan 2008 02:15 AM
conditional formatting - color Bert Microsoft Excel Discussion 3 4th Oct 2006 11:24 PM
Conditional color formatting entries have wild color. =?Utf-8?B?Sm9obiBHZXllcg==?= Microsoft Excel Misc 0 24th Feb 2006 06:11 PM
See conditional formatting Color value in vba Gunnar Sandström Microsoft Excel Programming 1 17th Nov 2005 01:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:53 PM.