Need Macro to reset dependent list

  • Thread starter Thread starter Bean Counter
  • Start date Start date
B

Bean Counter

Hi All,

I have a set of 2 lists, one dependent on the other. If the value of the
list in column A changes AFTER the value of the list in Column C is selected,
I would like for column C to reset, or blank out. I know this can be done
because I have seen it done before. It was code that was put into the sheet
itself. Can anyone help with this?
 
Right-click on the worksheet's name tab and choose [View Code] then copy and
paste the code below into the code module.

Private Sub Worksheet_Change(ByVal Target As Range)
'this will clear the contents of the cell
'in column C on the same row when a
'change in the entry in column A of that row
'is made
'assumes row 1 has labels you don't
'want to erase
'
If Target.Column = 1 And Target.Row > 1 Then
Target.Offset(0, 2).ClearContents
End If

End Sub
 
Hi

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Count > 1 Then Exit Sub
If Target.Column <> 1 Then Exit Sub

Application.EnableEvents = False
Target.Offset(0, 2).ClearContents
Application.EnableEvents = True

End Sub
 
Back
Top