Worksheet_SelectionChange

R

Rasmus

Quick question to all you Excel sharks out there; can I change the following
code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Rows(ActiveCell.Row).Select
End Sub

....to only select the entire row if I actually change ROW and not just
cell/range ?

(c:
Rasmus
 
W

William

Hi Rasmus

If you move from the cell you have selected and have now selected an entire
row, your code is redundant since you will be selecting the active row. Am I
missing something?

--
XL2002
Regards

William

(e-mail address removed)

| Quick question to all you Excel sharks out there; can I change the
following
| code:
|
| Private Sub Worksheet_SelectionChange(ByVal Target As Range)
| Rows(ActiveCell.Row).Select
| End Sub
|
| ...to only select the entire row if I actually change ROW and not just
| cell/range ?
|
| (c:
| Rasmus
|
|
 
W

William

Apologies, I did not read you post properly - try this.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static v As Variant
If Target.Row <> v Then Target.EntireRow.Select
v = Target.Row
End Sub


--
XL2002
Regards

William

(e-mail address removed)

| Hi Rasmus
|
| If you move from the cell you have selected and have now selected an
entire
| row, your code is redundant since you will be selecting the active row. Am
I
| missing something?
|
| --
| XL2002
| Regards
|
| William
|
| (e-mail address removed)
|
| | | Quick question to all you Excel sharks out there; can I change the
| following
| | code:
| |
| | Private Sub Worksheet_SelectionChange(ByVal Target As Range)
| | Rows(ActiveCell.Row).Select
| | End Sub
| |
| | ...to only select the entire row if I actually change ROW and not just
| | cell/range ?
| |
| | (c:
| | Rasmus
| |
| |
|
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top