• 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


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

Userform multiple Combobox lookup


New Member
Hello all this is my first post, I need some help please. I am still learning vba bit by bit. I have created a user form that is to calculate duration of part process based on quantity and cycle time. There are two criteria to attain the cycle the part number and the operation number as you will see in the sample file attached, How is the vba code written to lookup a part number and its associated operation sequence to populate the textbox with the correct cycle time to allow the multiplication to occur, I can do the maths in vba, I can do this in excel as you will see in the data sheet but the vba code alludes me. Thank you in advance



Well-Known Member
TextBox2 = Application.Index(Range("cycle"), Application.Match(ComboBox1 & "¬" & ComboBox2, [part & "¬" & Operation], 0))
Above split up into multiple lines to see how it's derived (look in the Locals pane to see what's in the variables):
xxx = [part & "¬" & Operation]
yyy = ComboBox1 & "¬" & ComboBox2
zzz = Application.Match(yyy, xxx, 0)
gm = Application.Index(Range("cycle"), zzz)
TextBox2 = gm


New Member
Thank you so much p45cal, this is such a brilliant compact piece of code it works perfectly, it feels good to be in the company of people who will come to your aid selflessly. Its is inspiring, again thank you.