View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Cursor cell in colour

Hi Bob:

Very pretty, after adding in a bunch of periods that I think you may have
been missing <g:

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

Regards,

Vasant

"Bob Phillips"
wrote in message
news:Bob.Phillips.1usluc_1125767115.7322@excelforu m-nospam.com...

Here is another alternative


'----------------------------------------------------------------
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.


--
Bob Phillips
------------------------------------------------------------------------
Bob Phillips's Profile:
http://www.excelforum.com/member.php...o&userid=26952
View this thread: http://www.excelforum.com/showthread...hreadid=401700