On change of key
Put this in the module of the worksheet where you have this list.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim currVal As Variant
Application.EnableEvents = False
If Not (Intersect(Target, Me.Range("G:G")) Is Nothing) Then
With Target
currVal = .Value
.EntireRow.Clear
.Value = currVal
End With
End If
Application.EnableEvents = True
End Sub
Notice, this makes Undo unavailable.
On Oct 19, 10:00 am, PurpleMilk
wrote:
In VBA, is there a way to tell when a key has changed?
For example, I have a list that users select from (in cell G10 - this is the
key), and under the list the users can enter some data associated with their
selection.
In the event they decide to go back and change their list selection (the
key), I would like to automatically clear out any input they already filled
so they can start again.
Any ideas?
|