ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Changing coloue cell en text colour by clicking cell (https://www.excelbanter.com/excel-discussion-misc-queries/445580-changing-coloue-cell-en-text-colour-clicking-cell.html)

hannes

Changing coloue cell en text colour by clicking cell
 
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



Don Guillett[_2_]

Changing coloue cell en text colour by clicking cell
 
On Saturday, March 24, 2012 2:16:13 AM UTC-5, hannes wrote:
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 tabview 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

hannes

Changing coloue cell en text colour by clicking cell
 

Right click sheet tabview 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?



Don Guillett[_2_]

Changing coloue cell en text colour by clicking cell
 
On Saturday, March 24, 2012 2:16:13 AM UTC-5, hannes wrote:
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


On Saturday, March 24, 2012 2:16:13 AM UTC-5, hannes wrote:
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




On Saturday, March 24, 2012 2:16:13 AM UTC-5, hannes wrote:
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



All times are GMT +1. The time now is 08:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com