Consulting

Results 1 to 3 of 3

Thread: Solved: Selection Change Event only if Row Selected Changes.

  1. #1
    VBAX Expert
    Joined
    Sep 2010
    Posts
    604
    Location

    Solved: Selection Change Event only if Row Selected Changes.


    Another problem I should know the answer to by now, but don't.

    How do I avoid running the CreateRowCellsTextBoxes Macro if the selection change stays within the same row?

    Thanks
    [vba]Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Not TheSameRow is Selected Then'<--Improper syntax to demonstrate my need
    Call CreateRowCellsTextBoxes
    End If

    End Sub[/vba]

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private prevRow As Long

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Target.Row <> prevRow Then '<--Improper syntax to demonstrate my need
    Call CreateRowCellsTextBoxes
    End If

    prevRow = Target.Row
    End Sub[/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Expert
    Joined
    Sep 2010
    Posts
    604
    Location
    Perfect

    Thanks Bob

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •