PDA

View Full Version : Solved: Selection Change Event only if Row Selected Changes.



frank_m
04-19-2011, 02:21 PM
:help
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
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

Bob Phillips
04-19-2011, 02:34 PM
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

frank_m
04-19-2011, 02:51 PM
Perfect :thumb

Thanks Bob