Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Changing a cell to the same tab index color as its value

I changed some of my other module code to pick up a number on this Worksheet
to use for the tab color index. These references are in cells O6 through O30.
It would be nice so that the O cell where number is stored will also change
to the same tab index color.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Changing a cell to the same tab index color as it's value

Hi CRayF,

CRayF wrote:
I changed some of my other module code to pick up a number on this
Worksheet to use for the tab color index. These references are in
cells O6 through O30. It would be nice so that the "O" cell where
number is stored will also change to the same tab index color.


You may want to use the built-in Worksheet_Change event to handle this.
That way, if you ever change the value of a cell in the range O6:O30, the
color will automatically refresh. To do this, right-click the worksheet tab
and select View Code. Then paste the following code into the code window:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngInt As Range
Dim c As Range

Set rngInt = Application.Intersect(Target, Range("O6:O30"))

If Not rngInt Is Nothing Then
For Each c In rngInt.Cells
c.Interior.ColorIndex = c.Value
Next c
End If

Set rngInt = Nothing
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Changing a cell to the same tab index color as it's value

Worked like a champ... thanks

"Jake Marx" wrote:

Hi CRayF,

CRayF wrote:
I changed some of my other module code to pick up a number on this
Worksheet to use for the tab color index. These references are in
cells O6 through O30. It would be nice so that the "O" cell where
number is stored will also change to the same tab index color.


You may want to use the built-in Worksheet_Change event to handle this.
That way, if you ever change the value of a cell in the range O6:O30, the
color will automatically refresh. To do this, right-click the worksheet tab
and select View Code. Then paste the following code into the code window:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngInt As Range
Dim c As Range

Set rngInt = Application.Intersect(Target, Range("O6:O30"))

If Not rngInt Is Nothing Then
For Each c In rngInt.Cells
c.Interior.ColorIndex = c.Value
Next c
End If

Set rngInt = Nothing
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]



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
Changing the color of a cell based on the color of another cell. LATC Excel Discussion (Misc queries) 7 December 4th 09 09:49 PM
Chart axes color index vs font color index [email protected] Charts and Charting in Excel 4 December 7th 06 04:05 PM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
Conditional Formatted Cell Color Index MDR5300 Excel Programming 5 January 27th 05 09:15 PM
Identify Cell Color Index Voskre Excel Programming 7 July 25th 04 12:10 AM


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