LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Macro - color tab

I have the following macro:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Application.Intersect(Target, Range("U246")) Is Nothing Then
If Target.Value = IsError(xlErrDiv0) Then
Sh.Tab.ColorIndex = xlColorIndexNone
Else
If Target.Value < 120 Then
Sh.Tab.Color = RGB(255, 0, 0)
Else
If Target.Value = 120 Then
Sh.Tab.ColorIndex = xlColorIndexNone
End If
End If
End If
End If
End Sub

It is suppose to change the tab color to red when cell U246 is below 120.
Instead it changes color when a value below 120 is entered into any cell. I
have this code in a workbook module, so it works on all worksheets in the
workbook. There is a formula in cell U246. When the value of this formula
is <120, the tab should turn red.
How do I get it to look at only cell U246 and not all cells to decide when
to change color?
Thanks in advance for any help,
rob


 
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
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM


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