LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default highlight of a range

David wrote

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("I5:S55").FormatConditions.Delete
If Intersect(Target, Range("I5:S55")) Is Nothing Then Exit Sub
With Range(Cells(Target.Row, 9), Cells(Target.Row, 19))
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 6
End With
End Sub


Was able to reduce to this:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("I5:S55").Interior.ColorIndex = 2
If Intersect(Target, Range("I5:S55")) Is Nothing Then Exit Sub
Range(Cells(Target.Row, 9), Cells(Target.Row, 19)).Interior.ColorIndex = 6
End Sub

Works as desired.

--
David
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i highlight the ten highest numbers in a range? Help Wanted Excel Discussion (Misc queries) 3 May 5th 09 06:39 PM
highlight the cell based on the range for a given value Narnimar Excel Discussion (Misc queries) 7 December 26th 07 02:43 PM
Highlight a range for data entry Kirk P. Excel Discussion (Misc queries) 2 August 28th 06 03:09 PM
Macro to Highlight Range LLoraine Excel Discussion (Misc queries) 2 April 19th 06 02:41 PM
want highlight when all cells in range are equal Jane Excel Worksheet Functions 4 November 16th 05 01:53 AM


All times are GMT +1. The time now is 10:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"