#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 54
Default Highlight rows

Hi Guys,Im pretty sure this cant be done but thought id check with the
brainstrust..
I have XL2003 and would like the entire row to be highlighted when im in a
particular cell so it is easy to reference data in other cells on that row. I
know i could click on the row number itself but is there a way for it to
happen by just being in a particular cell?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Highlight rows

I think this will do what you want:
Right-click the worksheet tab, and paste this code in the window that opens...

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


I forgot where I got this, but I think it was from this discussion group a
while back.


Regards,
Ryan---


--
RyGuy


"Scott R" wrote:

Hi Guys,Im pretty sure this cant be done but thought id check with the
brainstrust..
I have XL2003 and would like the entire row to be highlighted when im in a
particular cell so it is easy to reference data in other cells on that row. I
know i could click on the row number itself but is there a way for it to
happen by just being in a particular cell?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 54
Default Highlight rows

Hey Ryan,

That worked great!

Thanx!!

( I did have a browse in prev posts but couldnt find anything)

"ryguy7272" wrote:

I think this will do what you want:
Right-click the worksheet tab, and paste this code in the window that opens...

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


I forgot where I got this, but I think it was from this discussion group a
while back.


Regards,
Ryan---


--
RyGuy


"Scott R" wrote:

Hi Guys,Im pretty sure this cant be done but thought id check with the
brainstrust..
I have XL2003 and would like the entire row to be highlighted when im in a
particular cell so it is easy to reference data in other cells on that row. I
know i could click on the row number itself but is there a way for it to
happen by just being in a particular cell?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Highlight rows

Scott

Note this code will wipe out any Conditional Formatting you may have on cells.

Also highlights multiple selections.

Might be better of to go with Chip Pearson's RowLiner add-in that does not clear
CF's

http://www.cpearson.com/excel/RowLiner.htm


Gord Dibben MS Excel MVP


On Tue, 4 Dec 2007 14:41:01 -0800, Scott R
wrote:

Hey Ryan,

That worked great!

Thanx!!

( I did have a browse in prev posts but couldnt find anything)

"ryguy7272" wrote:

I think this will do what you want:
Right-click the worksheet tab, and paste this code in the window that opens...

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


I forgot where I got this, but I think it was from this discussion group a
while back.


Regards,
Ryan---


--
RyGuy


"Scott R" wrote:

Hi Guys,Im pretty sure this cant be done but thought id check with the
brainstrust..
I have XL2003 and would like the entire row to be highlighted when im in a
particular cell so it is easy to reference data in other cells on that row. I
know i could click on the row number itself but is there a way for it to
happen by just being in a particular cell?


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default Highlight rows

Are you looking for this effect? Assuming the cell you are interested in
reacting to is C4...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("C4").Address Then
Target.EntireRow.Select
Target.Activate
End If
End Sub

There are other ways to frame the test depending on exactly what criteria
you want to use.

Rick


"Scott R" wrote in message
...
Hi Guys,Im pretty sure this cant be done but thought id check with the
brainstrust..
I have XL2003 and would like the entire row to be highlighted when im in a
particular cell so it is easy to reference data in other cells on that
row. I
know i could click on the row number itself but is there a way for it to
happen by just being in a particular cell?




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 54
Default Highlight rows

Thanks for those, guys. Ill have a look and see which one is going to work
best.

Ta :)

"Rick Rothstein (MVP - VB)" wrote:

Are you looking for this effect? Assuming the cell you are interested in
reacting to is C4...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("C4").Address Then
Target.EntireRow.Select
Target.Activate
End If
End Sub

There are other ways to frame the test depending on exactly what criteria
you want to use.

Rick


"Scott R" wrote in message
...
Hi Guys,Im pretty sure this cant be done but thought id check with the
brainstrust..
I have XL2003 and would like the entire row to be highlighted when im in a
particular cell so it is easy to reference data in other cells on that
row. I
know i could click on the row number itself but is there a way for it to
happen by just being in a particular cell?



Reply
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
Compare and Highlight Rows Lisab New Users to Excel 12 December 6th 07 03:26 PM
highlight group of rows lilleke Excel Worksheet Functions 8 September 12th 07 01:40 PM
Formatting to highlight rows Angie Excel Discussion (Misc queries) 1 August 15th 06 11:41 PM
Can I highlight all the odd rows in Excel? paulkc Excel Discussion (Misc queries) 1 November 21st 05 01:46 PM
Any way to highlight rows without using macros? Spalding Excel Discussion (Misc queries) 2 November 9th 05 03:12 PM


All times are GMT +1. The time now is 08:27 AM.

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

About Us

"It's about Microsoft Excel"