• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

dinamic list combobox user form

aleksandra123

New Member
Hi All
Curretly I am creating user form in VBA and have a problem with one thing. I need to create combobox but with dinamic list. I mean to the list I will be add new Line. Please help

I have code

Private Sub ComboBox4_Change()
cbDays.RowSource = "Sheet1!I7:I" & Range("I" & Rows.Count).End(xlUp).Row
End Sub

However it does not work.
 
May be
Code:
Private Sub UserForm_Initialize()
    Dim cel As Range
    For Each cel In Sheets("Sheet1").Range("I7:I" & Sheets("Sheet1").Cells(Rows.Count, "I").End(xlUp).Row)
        ComboBox1.AddItem cel
    Next cel
End Sub
 
Have you tried
Code:
cbDays.RowSource = "Sheet1!I7:I" & Sheets("Sheet1").Range("I" & Rows.Count).End(xlUp).Row
?
 
Two above codes also dont work... I upload the file. there is userform in vba view and the I need to fill in combobox4 which should refer to the list from bookmark "zad2" , cell I7 thank you for your answer
 

Attachments

What's your problem?
You said
Code:
Private Sub ComboBox4_Change()
cbDays.RowSource = "Sheet1!I7:I" & Range("I" & Rows.Count).End(xlUp).Row
End Sub
But, you don't have such ComboBox named "cbDays".

State your problem/logic in plain text in understandable format.
 
What's your problem?
You said
Code:
Private Sub ComboBox4_Change()
cbDays.RowSource = "Sheet1!I7:I" & Range("I" & Rows.Count).End(xlUp).Row
End Sub
But, you don't have such ComboBox named "cbDays".

State your problem/logic in plain text in understandable format.

yes yes sorry I forgotten to change cbDays for Combobox4 name. Even if I change it for correct name the list donot appear in the user form. There is blank row. Above I have also drop down list but it's working. However that list wont be changed therefore I use other way to creat it. Now is it clear?
 
Completely lost.

What list to what combobox?
oh no :) let's try one again :)

I have user form. There is label named "Produkt" next to it there is combobox. That combobox should refer to the list in bookmark "Zad2" range I7:I15. However the list should be dinamic because later on I will be added some things to it . Are you still lost?
 
Then what's wrong with the code I have already posted?
Code:
RowSource = "Zad2!I7:I" & Sheets("Zad2").Range("I" & Rows.Count).End(xlUp).Row
 
Back
Top