hightlighting rows?

  • Thread starter Thread starter just1creation
  • Start date Start date
J

just1creation

is it possible to a row to be highlighted automatically when the curso
lands on that row?

example:
if my cursor lands on A1, i would like the whole row to be highlighted
and when i press enter and the cursor drops down to A2, then that ro
will be highlighted. and A1 is no longer highlighted..
 
right click sheet tab>view code>insert this>save

'McCurdy.Here is something inspired by Don Guillett.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim MyRng As Range
Set MyRng = Target.EntireRow
Application.EnableEvents = False
On Error GoTo end1
Application.Cells.FormatConditions.Delete
With MyRng
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=ROW()=ROW(INDIRECT(CELL(""address"")))"
With .FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 1
End With
.FormatConditions(1).Interior.ColorIndex = 36
End With
end1:
Application.EnableEvents = True
End Sub

--
Don Guillett
SalesAid Software
(e-mail address removed)
"just1creation" <[email protected]>
wrote in message
news:[email protected]...
 
can you make it so that when you print it still looks the same...
because now when i print it, it shows that it is highlight and in bold
letters.:)
 
You can comment out the code or select a cell(row) outside the print range
or use a before print event in the ThisWorkbook module to remove the
formatting.


--
Don Guillett
SalesAid Software
(e-mail address removed)
"just1creation" <[email protected]>
wrote in message
news:[email protected]...
 
Because this is a SELECTION event. If you want to do that on that sheet then
comment out the code or change to a worksheet_change event so the row will
not be highlighted unless you change something.

--
Don Guillett
SalesAid Software
(e-mail address removed)
"just1creation" <[email protected]>
wrote in message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top