Can't seem to figure out what's going on here. I have the first combo box which I can select the day and the second combo box will display the month.
Everything works fine until I select a day in which there is only one month and then I get the following error.
Error 381 (Could not set the List property Invalid property array index)
Is this also the best way to populate the second combo box off of the results from the first?
I ran a breakpoint and cbomonth shows null.
Private Sub cboday_Change()
On Error GoTo cboday_Change_Error
Application.ScreenUpdating = False
With Sheets("Data")
.Range(.Range("A1"), .Range("A" & .Rows.Count).End(xlUp)).AutoFilter _
Field:=1, _
Criteria1:=Me.cboday.Value
.Columns("G").ClearContents
.Columns("B:B").SpecialCells(xlCellTypeVisible).Copy .Range("G1")
Application.CutCopyMode = False
.AutoFilterMode = False
Me.cbomonth.List = .Range(.Cells(2, 7), .Cells(.Rows.Count, 7).End(xlUp)).Value
End With
Me.cbomonth.SetFocus
Application.ScreenUpdating = True
On Error GoTo 0
Exit Sub
cboday_Change_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cboday_Change of Form UserForm1"
End Sub
Bookmarks