Worksheet_SelectionChange

  • Thread starter Thread starter Rasmus
  • Start date Start date
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
 
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
|
|
 
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
| |
| |
|
|
|
|
 
Back
Top