PDA

View Full Version : Color Row



marreco
02-06-2012, 06:27 PM
Good night!
I would like to double-click any cell of a given line and that line will have the interior painted.


Example.
If I do click dus times in "A1" or "D1" or "H1" then a line will be colored.

this code is very similar, but paint the inside only the active cell, and I would like to paint the entire line.

Cross-post:http://www.ozgrid.com/forum/showthread.php?t=162161

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


If Target.Interior.ColorIndex = xlNone Then


Target.Interior.ColorIndex = 3


ElseIf Target.Interior.ColorIndex = 3 Then


Target.Interior.ColorIndex = xlNone

End If


Cancel = True

End Sub

Kenneth Hobs
02-06-2012, 08:34 PM
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
With Target
If .Interior.ColorIndex = xlNone Then
.EntireRow.Interior.ColorIndex = 3
ElseIf .Interior.ColorIndex = 3 Then
Target.EntireRow.Interior.ColorIndex = xlNone
End If
End With
End Sub

marreco
02-07-2012, 03:12 AM
It was perfect! :clap:

Thank you very much!