View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Highlighting the active row

Have a look in the ThisWorkbook module & put the code within the
Private Sub Workbook_SheetSelectionChange(
--
Don Guillett
SalesAid Software

"Daniel Bonallack" wrote in
message ...
Bob Philips provided the code below in answer to someone's question. It
highlights the line of the active cell. This is SO useful to my team,

that I
want to be able to add it to any worksheet we use.

1. Is there a way to make a macro that adds code (the code below) to the
active worksheet? (I would then make an addin for the group that copies

in
the below)

2. If not, can the below be applied easily to every sheet in a workbook?

3. If I wanted this to be part of the default workbook (Excel XP), how
would I do this? Would it then be present on every sheet added?

Daniel
(PS, thanks Bob)

_________________________________

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