Hi Nwhan,
I asked the same question sometime ago and was offered the following
solutions were offered by Julie D, Bob Philips and Ron de Bruin.
See below.
Hi Pank
found this code from an old post by Earl Kiosterud - which seems to do what
you require
---------
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static Roww As Integer
Static NotFirstTime As Boolean
Application.EnableEvents = False
If NotFirstTime Then ' remove color fill from prior row
Range(Cells(Roww, 1), Cells(Roww, 10)).Interior.ColorIndex = xlNone
Else
NotFirstTime = True
End If
Range(Cells(Target.Row, 1), Cells(Target.Row, 10)).Select
Roww = Selection.Row ' save current row for uncoloring when row exited
Selection.Interior.ColorIndex = 4 ' color current row
Application.EnableEvents = True
End Sub
------------
to utilise the code, right mouse click on the sheet tab of the sheet you
want to use this in - choose view code - and copy & paste the code in there
use alt & f11 to switch back to the sheet and try it
Cheers
JulieD
'----------------------------------------------------------------
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
See this Add-in
http://www.cpearson.com/excel/RowLiner.htm