Hi there,
I have a spreadsheet that by way of user input creates a list with a varying number of rows. The first first two rows contain drop down menus; second dependent on selection in first. First row draws upon a named range "Defect".
Problem is, because the number of rows vary, I can't figure out how to create the second, dependent menu. This is the code pertaining to the second drop down:
Set rng = Range(Cells(headerrow + 2, headercol + 1), Cells(headerrow + 2 + faileditemcount - 1, headercol + 1))
If rng.Offset(, -1).Value <> "" Then
With rng.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(" & rng.Offset(, -1).Address & ")"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
I believe I need If rng.Offset(, -1).Value <> "" Then to handle the initial blank value in the first column. This is however, where the code fails (among other places).
Thanks.
Bookmarks