Changing coloue cell en text colour by clicking cell

  • Thread starter Thread starter hannes
  • Start date Start date
H

hannes

Hi.

In a worksheet i want to change colour te red and the text colour to white
when a click one of the cell in the range O22:X44.
Is this possible?

Hannes
 
Hi.

In a worksheet i want to change colour te red and the text colour to white
when a click one of the cell in the range O22:X44.
Is this possible?

Hannes

Right click sheet tab>view code copy this for a DOUBLE click

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)

If Intersect(Target, Range("o22:x44")) _
Is Nothing Then Exit Sub

With Target
.Interior.ColorIndex = 46
.Font.ColorIndex = 2
End With
End Sub
 
Right click sheet tab>view code copy this for a DOUBLE click

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)

If Intersect(Target, Range("o22:x44")) _
Is Nothing Then Exit Sub

With Target
.Interior.ColorIndex = 46
.Font.ColorIndex = 2
End With
End Sub

Thanks works perfect. Would it be possible to undo the changes by clicking
again?
 
Hi.

In a worksheet i want to change colour te red and the text colour to white
when a click one of the cell in the range O22:X44.
Is this possible?

Hannes
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("o22:x44")) _
Is Nothing Then Exit Sub
With Target
If .Interior.ColorIndex = 46 Then
..Interior.ColorIndex = 0
..Font.ColorIndex = 1
Else
..Interior.ColorIndex = 46
..Font.ColorIndex = 2
End If
End With
End Sub


Hi.

In a worksheet i want to change colour te red and the text colour to white
when a click one of the cell in the range O22:X44.
Is this possible?

Hannes
 
Back
Top