Results 1 to 4 of 4

Populate one combo box from results of another combo box

Threaded View

  1. #1
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Populate one combo box from results of another combo box

    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
    Last edited by jeffreybrown; 09-07-2010 at 04:52 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1