I figured this one out. The code above has changed to:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngAllParentCells As Range
Dim rngDepCells As Range
Dim rngCell As Range
If Target.Cells.Count > 1 Then Exit Sub
Set rngAllParentCells = Range("Table1[Category]")
Set rngDepCells = Intersect(Target, rngAllParentCells)
If Not rngDepCells Is Nothing Then
For Each rngCell In rngDepCells.Cells
rngCell.Offset(RowOffset:=0, ColumnOffset:=1).ClearContents
Dim PW As String
PW = "orderform"
With Sheets("Order")
.Unprotect _
Password:=PW
Select Case Target.Value
Case Is = "Mineral"
rngCell.Offset(RowOffset:=0, ColumnOffset:=1).Value = "N/A"
With rngCell.Offset(RowOffset:=0, ColumnOffset:=1).Validation
.Delete
End With
rngCell.Offset(RowOffset:=0, ColumnOffset:=0).Select
Case Is = "Animal"
With rngCell.Offset(RowOffset:=0, ColumnOffset:=1).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Animal"
.InCellDropdown = True
End With
rngCell.Offset(RowOffset:=0, ColumnOffset:=1).Select
Case Is = "Vegetable"
With rngCell.Offset(RowOffset:=0, ColumnOffset:=1).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Vegetable"
.InCellDropdown = True
End With
rngCell.Offset(RowOffset:=0, ColumnOffset:=1).Select
End Select
.Protect _
Password:=PW
End With
Next rngCell
End If
Set rngAllParentCells = Nothing
Set rngDepCells = Nothing
Set rngCell = Nothing
End Sub
No longer able to call the INDIRECT function, each option must be explicitly specified in the macro. This works fine for a smaller dependent list, but could be problematic for a longer list, I'm sure there is a more elegant way to solve this, but this works for me. Hopefully someone else looking for similar functionality will benefit from my labors on this one.
functioning solution attached.
Bookmarks