It's the middle of the morning, I'm tired and I'll be going to sleep soon,
so that may have something to do with my blind spot at the moment, but what
am I missing that will cause the recursion you mention? Granting that you
are probably right (so thank you for posting your modification), we can
shorten your code by two lines...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.EntireRow.Select
Target.Activate
ErrHandler:
Application.EnableEvents = True
End Sub
Oh, and earlier I was thinking that if the OP wanted to highlight a group of
cells for some reason, he wouldn't be able to unless we restricted the code
to single cell selections; so this is probably a better coding for the OP to
use...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ErrHandler
If Target.Count 1 Then Exit Sub
Application.EnableEvents = False
Target.EntireRow.Select
Target.Activate
ErrHandler:
Application.EnableEvents = True
End Sub
Rick
"Tim Zych" <tzych@NOSp@mE@RTHLINKDOTNET wrote in message
...
A slight modification to avoid recursion:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.EntireRow.Select
Target.Activate
Application.EnableEvents = True
Exit Sub
ErrHandler:
Application.EnableEvents = True
End Sub
--
Tim Zych
SF, CA
"Rick Rothstein (MVP - VB)" wrote in
message ...
I have a work sheet that has alot of data entry on each row, I would
like to
know, when I arrow down to whatever row I want to work on could the
entire
row auto highlight, and when I move to the next row have that row auto
highlight and so on
Does this macro do what you want?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.EntireRow.Select
Target.Activate
End Sub
Right-click the worksheet tab for the sheet you want this functionality
on and select View Code from the popup menu. Copy/Paste the above
subroutine into the code window that appears. Now, go back to the
worksheet and mouse-click, tab, Enter and/or arrow key around the sheet.
Rick