ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Need Macro to reset dependent list (https://www.excelbanter.com/excel-discussion-misc-queries/263603-need-macro-reset-dependent-list.html)

Bean Counter[_2_]

Need Macro to reset dependent list
 
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?
--
Thanks for all of the help. It is much appreciated!!!!

JLatham

Need Macro to reset dependent list
 
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


"Bean Counter" wrote:

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?
--
Thanks for all of the help. It is much appreciated!!!!


Roger Govier[_8_]

Need Macro to reset dependent list
 
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

--
Regards
Roger Govier

Bean Counter wrote:
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?



All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com