Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Change Color of Cell

I would like to change the color of the active cell to
a specified color when the focus is in that cell and then
when it moves to another revert to white.

also if the cell has another sheet name in it that when
the user selects that cell the active sheet is changed to
the new sheet
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Change Color of Cell

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.FormatConditions.Delete
With Target
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
End With
.FormatConditions(1).Interior.ColorIndex = 20
End With

End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel Bennett" wrote in message
...
I would like to change the color of the active cell to
a specified color when the focus is in that cell and then
when it moves to another revert to white.

also if the cell has another sheet name in it that when
the user selects that cell the active sheet is changed to
the new sheet



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Change Color of Cell

Hi Nigel
This works but needs to be placed in the ThisWorkbook object.



Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
Range("A1:M20").Interior.ColorIndex = 0
Target.Interior.ColorIndex = 7
If Left(Target, 5) = "Sheet" Then Sheets(Target.Value).Activate
End Sub

Regards
Andrew Bourke


Nigel Bennett wrote:
I would like to change the color of the active cell to
a specified color when the focus is in that cell and then
when it moves to another revert to white.

also if the cell has another sheet name in it that when
the user selects that cell the active sheet is changed to
the new sheet

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Change Color of Cell

Hi Nigel
This works but needs to be placed in the ThisWorkbook object.



Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
Range("A1:M20").Interior.ColorIndex = 0
Target.Interior.ColorIndex = 7
If Left(Target, 5) = "Sheet" Then Sheets(Target.Value).Activate
End Sub

Regards
Andrew Bourke


Nigel Bennett wrote:

I would like to change the color of the active cell to a specified

color when the focus is in that cell and then when it moves to another
revert to white.

also if the cell has another sheet name in it that when the user

selects that cell the active sheet is changed to the new sheet








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Change Color of Cell

Hi Nigel
This works but needs to be placed in the ThisWorkbook object.



Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
Range("A1:M20").Interior.ColorIndex = 0
Target.Interior.ColorIndex = 7
If Left(Target, 5) = "Sheet" Then Sheets(Target.Value).Activate
End Sub

Regards
Andrew Bourke




Nigel Bennett wrote:
I would like to change the color of the active cell to
a specified color when the focus is in that cell and then
when it moves to another revert to white.

also if the cell has another sheet name in it that when
the user selects that cell the active sheet is changed to
the new sheet

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
Cannot change font color or cell color Bezell Excel Discussion (Misc queries) 2 January 30th 09 06:12 PM
Change tab color based on current color of a cell MarkT Excel Discussion (Misc queries) 0 May 22nd 08 05:46 PM
Excel: Syntax to change cell color based on color of another cell davew18 Excel Worksheet Functions 1 January 4th 07 01:24 PM
How to change the default Border, Font Color, and Cell Color Elijah Excel Discussion (Misc queries) 3 November 2nd 05 11:52 PM
Browse Forms Controls and change TextBox color based on cell color StefanW Excel Programming 2 November 21st 04 07:06 PM


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