• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Highlight Active Row

Shay A

Member
Hi,
How can this code be changed so that only the row of the active cell will be selected?

Thank you,
>> Use Code -tags <<
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LocalSelect As String
With Target
If .Count = 1 Then LocalSelect = .Address & "," & .row & ":" & .row & "," & _ Left(.Address, InStr(2, .Address, "$") - 1) & _ ":" & Left(.Address, InStr(2, .Address, "$") - 1)
End If
End With
On Error Resume Next
Range(LocalSelect).Select
End Sub
 
Last edited by a moderator:
Shay A
Could below work with Your case?
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    ay = Target.Row
    Application.EnableEvents = False
    Rows(ay & ":" & ay).Select
    Application.EnableEvents = True
End Sub
 
Back
Top