aenamorado
New Member
- Joined
- Jun 14, 2012
- Messages
- 1
Hello, first of all thanks for dropping by.
I have the first drop down list that allows you to select 1 of 4 categories, and based on the category selected, it will then allow you to select the specific name within the category. Right now, I am trying to give the user a chance to input additional items into the category.
It currently does add on to the list through the drop down menu. The problem I have with my program is that but it does not add into the specific list that has been selected by the first drop down. I would be grateful for the assistance.
I followed the steps outlined in this link:
http://www.contextures.com/excel-data-validation-add.html
Currently working with this code, but I don't know how to work in my dependant lists into it
</PRE>
I have the first drop down list that allows you to select 1 of 4 categories, and based on the category selected, it will then allow you to select the specific name within the category. Right now, I am trying to give the user a chance to input additional items into the category.
It currently does add on to the list through the drop down menu. The problem I have with my program is that but it does not add into the specific list that has been selected by the first drop down. I would be grateful for the assistance.
I followed the steps outlined in this link:
http://www.contextures.com/excel-data-validation-add.html
Currently working with this code, but I don't know how to work in my dependant lists into it
Code:
Private Sub Worksheet_Change(ByVal Target As Range)On Error Resume NextDim ws As WorksheetDim str As StringDim i As IntegerDim rngDV As RangeDim rng As RangeIf Target.Count > 1 Then Exit SubSet ws = Worksheets("Lists") If Target.Row > 1 Then On Error Resume Next Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation) On Error GoTo 0 If rngDV Is Nothing Then Exit Sub If Intersect(Target, rngDV) Is Nothing Then Exit Sub str = Target.Validation.Formula1 str = Right(str, Len(str) - 1) On Error Resume Next Set rng = ws.Range(str) On Error GoTo 0 If rng Is Nothing Then Exit Sub If Application.WorksheetFunction _ .CountIf(rng, Target.Value) Then Exit Sub Else i = ws.Cells(Rows.Count, rng.Column).End(xlUp).Row + 1 ws.Cells(i, rng.Column).Value = Target.Value rng.Sort Key1:=ws.Cells(1, rng.Column), _ Order1:=xlAscending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom End IfEnd IfEnd Sub
</PRE>
</PRE>
</PRE>
Last edited: