Posts by arafeek

    Hi there,


    I am new to VBA, and trying to make a userform that help the user to fill information, 2 of the fields are ComboBox areas, One is called BizCat and the other is BizSub.


    I want to the list of the second box (BizSub) to depend on the selection of the first box (BizCat), I have listed categories (Cat) and subcategories (Sub) in Sheet 2, and the first list of Subs is from A17 to A19, the second list of Subs is from A24 to A25, so it is a short list.


    Below is the code that I am using ( I found it online on another website):


    Code
    Private Sub BizCat_Change()
    BizSub.Value = Empty
    If BizCat.Value = "Eat" Then
    BizSub.ListFillRange = "=Sheet2!A17:A19"
    Else
    BizSub.ListFillRange = "=Sheet2!A24:A25"
    End If
    End Sub


    but when I select any item in the first box, I get the compile error (Method or Data member not found)


    Someone suggested to make sheet2 active and save, but it did not work.


    Any idea please?


    I am using Excel 2016 and Windows10


    Many thanks in advance