Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 187
Default automatically highlight a row when a cell in that row is selected

I imagine this is a pretty simple piece of VBA programming.

I want Excel to automatically highlight a row when I select a cell
from that row. For example, if I select G20, I want row 20 to be
highlighted, say, in yellow.

I'm using Excel 2007 and Windows XP if it matters.

Thanks for the help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default automatically highlight a row when a cell in that row is selected

Dave;
Will this come in handy ?
You can change the color code (15) to your likings (3 = red).
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
'Toggles worksheet colors
'Code will remove all color and color active row and column

If ActiveCell.Interior.ColorIndex < xlNone Then
Cells.Interior.ColorIndex = xlNone
Else
Cells.Interior.ColorIndex = xlNone
ActiveCell.EntireColumn.Interior.ColorIndex = 15
ActiveCell.EntireRow.Interior.ColorIndex = 15
End If

End Sub


--
Regards;
Mark Rosenkrantz
--
Spreadsheet Solutions
Uithoorn
Netherlands
--
E:
W:
www.spreadsheetsolutions.nl
--
"Dave F" wrote in message
...
I imagine this is a pretty simple piece of VBA programming.

I want Excel to automatically highlight a row when I select a cell
from that row. For example, if I select G20, I want row 20 to be
highlighted, say, in yellow.

I'm using Excel 2007 and Windows XP if it matters.

Thanks for the help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default automatically highlight a row when a cell in that row is selected

Place this macro in the sheet module of your sheet. You can access that
module by right-clicking on the sheet tab and selecting View Code.. "X" out
of the module to return to your sheet. HTH Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.EntireRow.Interior.ColorIndex = 6
End Sub
"Dave F" wrote in message
...
I imagine this is a pretty simple piece of VBA programming.

I want Excel to automatically highlight a row when I select a cell
from that row. For example, if I select G20, I want row 20 to be
highlighted, say, in yellow.

I'm using Excel 2007 and Windows XP if it matters.

Thanks for the help.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default automatically highlight a row when a cell in that row is selected

This might help:

http://www.codeforexcelandoutlook.co...r-your-target/

--JP

On Oct 14, 12:01*pm, Dave F wrote:
I imagine this is a pretty simple piece of VBA programming.

I want Excel to automatically highlight a row when I select a cell
from that row. *For example, if I select G20, I want row 20 to be
highlighted, say, in yellow.

I'm using Excel 2007 and Windows XP if it matters.

Thanks for the help.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 187
Default automatically highlight a row when a cell in that row is selected

This is exactly what I need.

Thanks.

On Oct 14, 12:31*pm, JP wrote:
This might help:

http://www.codeforexcelandoutlook.co...r-your-target/

--JP

On Oct 14, 12:01*pm, Dave F wrote:

I imagine this is a pretty simple piece of VBA programming.


I want Excel to automatically highlight a row when I select a cell
from that row. *For example, if I select G20, I want row 20 to be
highlighted, say, in yellow.


I'm using Excel 2007 and Windows XP if it matters.


Thanks for the help.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default automatically highlight a row when a cell in that row is selected


How about code that puts a border around the current row instead? This way,
if you have conditional formatting on your cells, the highlight will
cooperate with it. Give this a try. Right click the tab at the bottom of the
worksheet you want to have this functionality, select View Code from the
popup menu that appears and then copy/paste the following into the code
window that opened up...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo Whoops
Application.ScreenUpdating = False
Cells.Borders.LineStyle = xlLineStyleNone
Target.EntireRow.BorderAround Weight:=xlMedium
Whoops:
Application.ScreenUpdating = True
End Sub

--
Rick (MVP - Excel)


"Dave F" wrote in message
...
I imagine this is a pretty simple piece of VBA programming.

I want Excel to automatically highlight a row when I select a cell
from that row. For example, if I select G20, I want row 20 to be
highlighted, say, in yellow.

I'm using Excel 2007 and Windows XP if it matters.

Thanks for the help.


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
Highlight selected cell Hong Excel Programming 8 August 31st 07 11:16 AM
Highlight selected cell GKW in GA Excel Discussion (Misc queries) 2 November 12th 06 01:47 PM
How do I have a cell highlight when selected? Rhonda Excel Worksheet Functions 2 October 2nd 06 09:09 PM
How do I have a cell highlight when selected? Rhonda Excel Worksheet Functions 1 October 2nd 06 06:06 PM
How do I have a cell highlight when selected? Rhonda Excel Discussion (Misc queries) 0 October 2nd 06 05:12 PM


All times are GMT +1. The time now is 04:24 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"