View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Raj Mazumdar
 
Posts: n/a
Default Highlighting the active row with special colour

Perfecto! Thanks Bob... you guys are the best...

"Bob Phillips" wrote:

Hi Raj,

You know the answer is alwasy yes <vbg

Option Explicit

'----------------------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
With .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
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With

End Sub

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Raj Mazumdar" wrote in message
...
Perfect, Bob... the colour is a very soothing one too... thanks a tonne.
There isn't a way to do just the row, eh? Never mind if there isn't...

this
one'll work pretty well for me too... Thanks a bunch again... Have a great
one.

Raj

"Bob Phillips" wrote:

Try this


'----------------------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
With .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
.Interior.ColorIndex = 20
End With
End With
With .EntireColumn
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
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
'the View Code option from the menu, and paste the code in.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Raj Mazumdar" wrote in message
...
Highlight it in a particular colour, I meant... that would move along

when
I
would move the cursor onto another row....

"Raj Mazumdar" wrote:

Hi there

Is there a macro that highlights the whole active row (not only the
active
cell) that the cursor is in, in an Excel worksheet?

Thanks

Raj