PC Review


Reply
Thread Tools Rate Thread

automatically highlight a row when a cell in that row is selected

 
 
Dave F
Guest
Posts: n/a
 
      14th Oct 2009
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 With Quote
 
 
 
 
Spreadsheet Solutions
Guest
Posts: n/a
 
      14th Oct 2009
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: (E-Mail Removed)
W: www.spreadsheetsolutions.nl
--
"Dave F" <(E-Mail Removed)> wrote in message
news:ce963a4e-bd05-4f74-8d19-(E-Mail Removed)...
>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 With Quote
 
JP
Guest
Posts: n/a
 
      14th Oct 2009
This might help:

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

--JP

On Oct 14, 12:01*pm, Dave F <friedd...@gmail.com> 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.


 
Reply With Quote
 
Dave F
Guest
Posts: n/a
 
      14th Oct 2009
This is exactly what I need.

Thanks.

On Oct 14, 12:31*pm, JP <jp2...@earthlink.net> wrote:
> This might help:
>
> http://www.codeforexcelandoutlook.co...r-your-target/
>
> --JP
>
> On Oct 14, 12:01*pm, Dave F <friedd...@gmail.com> 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.


 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      14th Oct 2009

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" <(E-Mail Removed)> wrote in message
news:ce963a4e-bd05-4f74-8d19-(E-Mail Removed)...
>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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell won't highlight when selected TJAC Microsoft Excel Misc 0 13th Jan 2009 08:53 PM
Highlight selected cell =?Utf-8?B?R0tXIGluIEdB?= Microsoft Excel Misc 2 12th Nov 2006 01:47 PM
How do I have a cell highlight when selected? =?Utf-8?B?UmhvbmRh?= Microsoft Excel Worksheet Functions 2 2nd Oct 2006 09:09 PM
How do I have a cell highlight when selected? =?Utf-8?B?UmhvbmRh?= Microsoft Excel Worksheet Functions 1 2nd Oct 2006 06:06 PM
How do I have a cell highlight when selected? =?Utf-8?B?UmhvbmRh?= Microsoft Excel Misc 0 2nd Oct 2006 05:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 PM.