View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Change cell font color when cell is clicked

Untested.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("L2:M500")) Is Nothing Then
tr = Target.Row
Target.Interior.ColorIndex = 5
Cells(tr, "J") = Cells(tr, "e") * Cells(tr, "i") * Target
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"aileen" wrote in message
...
I should be more specific. The formula is simple it's the product of 3
cells, 2 of which are fixed and the last one should become whichever cell
I've clicked.

Cells(j, "J") = Cells(j, "E") * Cells(j, "I") * highlighted cell

Is this possible to do?


"Don Guillett" wrote:

Nothing wrong with what you present.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"aileen" wrote in message
...
I'm trying to find code that will change the font color or interior
color
in
a cell when the cell is clicked once. Then when the color changes I
need
to
recalculate a formula from a different cell in the same row based on
which
cell was chosen and had the color change.

I was trying the following code as a start but I am getting an "End If
without a Block If" error.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("L2:M500")) Is Nothing Then
Target.Interior.ColorIndex = 5
End If
End Sub

Any help is greatly appreciated.


.