Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
mike47338
 
Posts: n/a
Default 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   Report Post  
JE McGimpsey
 
Posts: n/a
Default

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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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   Report Post  
mike47338
 
Posts: n/a
Default

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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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   Report Post  
mike47338
 
Posts: n/a
Default

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
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
Can't format cell color/text color in Office Excel 2003 in fil Tony S Excel Discussion (Misc queries) 1 December 21st 07 02:41 PM
Change cell back color on click Dave Peterson Excel Discussion (Misc queries) 0 January 24th 05 11:50 PM
Color change in cell when > 49.99 Slumbering Gorilla Excel Discussion (Misc queries) 1 January 24th 05 09:11 PM
cell color shading stacydoo Excel Discussion (Misc queries) 1 December 10th 04 08:44 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 08:16 PM


All times are GMT +1. The time now is 01:31 PM.

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"