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

[email protected]

| 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

[email protected]

| 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
|
| [email protected]
|
| | | 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
| |
| |
|
|
|
|
 
Top