Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlight of a range
I have a spreadsheet that has several hundred rows and 25 columns of info. I
would like to be able to highlight the entire row of information that the cursur is in and the highlighted row moves as the cursur moves. I am not sure how to do this please help thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlight of a range
right click on the sheet tab and select view code
paste in code like this: Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range) Static OldRange As Range On Error Resume Next Target.Entirerow.Interior.ColorIndex = 6 ' yellow - change as needed OldRange.EntireRow.Interior.ColorIndex = xlColorIndexNone Set OldRange = Target End Sub Adapted from code by Chip Pearson. http://www.cpearson.com/excel/excelM...ightActiveCell -- Regards, Tom Ogilvy "shawn" wrote in message ... I have a spreadsheet that has several hundred rows and 25 columns of info. I would like to be able to highlight the entire row of information that the cursur is in and the highlighted row moves as the cursur moves. I am not sure how to do this please help thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlight of a range
Tom Ogilvy wrote
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range) Static OldRange As Range On Error Resume Next Target.Entirerow.Interior.ColorIndex = 6 ' yellow - change as needed OldRange.EntireRow.Interior.ColorIndex = xlColorIndexNone Set OldRange = Target End Sub Can you help me adapt your seemingly more efficient method to a limited range of cells? Code I currently use: 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 -- David |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i highlight the ten highest numbers in a range? | Excel Discussion (Misc queries) | |||
highlight the cell based on the range for a given value | Excel Discussion (Misc queries) | |||
Highlight a range for data entry | Excel Discussion (Misc queries) | |||
Macro to Highlight Range | Excel Discussion (Misc queries) | |||
want highlight when all cells in range are equal | Excel Worksheet Functions |