Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Current Cell Color
Is there any way to make a cell change color when you click in it and then go
back to it's original color when you go to another cell and each cell do the same thing when it is the current cell? |
#2
|
|||
|
|||
Take a look at Chip Pearson's RowLiner add-in:
http://cpearson.com/excel/rowliner.htm In article , mike47338 wrote: Is there any way to make a cell change color when you click in it and then go back to it's original color when you go to another cell and each cell do the same thing when it is the current cell? |
#3
|
|||
|
|||
This is what I use
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.FormatConditions.Delete With Target.EntireRow .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) "mike47338" wrote in message ... Is there any way to make a cell change color when you click in it and then go back to it's original color when you go to another cell and each cell do the same thing when it is the current cell? |
#4
|
|||
|
|||
This works very well except what can I change "With Target.EntireRow" to so
that only the active cell is highlighted? "Bob Phillips" wrote: This is what I use Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.FormatConditions.Delete With Target.EntireRow .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) "mike47338" wrote in message ... Is there any way to make a cell change color when you click in it and then go back to it's original color when you go to another cell and each cell do the same thing when it is the current cell? |
#5
|
|||
|
|||
Mike,
Just change the line With Target.Entirerow to With Target -- HTH RP (remove nothere from the email address if mailing direct) "mike47338" wrote in message ... This works very well except what can I change "With Target.EntireRow" to so that only the active cell is highlighted? "Bob Phillips" wrote: This is what I use Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.FormatConditions.Delete With Target.EntireRow .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) "mike47338" wrote in message ... Is there any way to make a cell change color when you click in it and then go back to it's original color when you go to another cell and each cell do the same thing when it is the current cell? |
#6
|
|||
|
|||
Thanks Bob, that is exactly what I was looking for !!
"Bob Phillips" wrote: Mike, Just change the line With Target.Entirerow to With Target -- HTH RP (remove nothere from the email address if mailing direct) "mike47338" wrote in message ... This works very well except what can I change "With Target.EntireRow" to so that only the active cell is highlighted? "Bob Phillips" wrote: This is what I use Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.FormatConditions.Delete With Target.EntireRow .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) "mike47338" wrote in message ... Is there any way to make a cell change color when you click in it and then go back to it's original color when you go to another cell and each cell do the same thing when it is the current cell? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't format cell color/text color in Office Excel 2003 in fil | Excel Discussion (Misc queries) | |||
Change cell back color on click | Excel Discussion (Misc queries) | |||
Color change in cell when > 49.99 | Excel Discussion (Misc queries) | |||
cell color shading | Excel Discussion (Misc queries) | |||
GET.CELL | Excel Worksheet Functions |