• 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.

Userform multiple Combobox lookup

Learner85

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
 

Attachments

  • cycle time file.xlsm
    25.7 KB · Views: 8
Code:
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):
Code:
xxx = [part & "¬" & Operation]
yyy = ComboBox1 & "¬" & ComboBox2
zzz = Application.Match(yyy, xxx, 0)
gm = Application.Index(Range("cycle"), zzz)
TextBox2 = gm
 
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.
 
I have attached the completed sample file for others interest. Tab through the userform and each textbox presents its data, once again thank you p45cal
 

Attachments

  • cycle time file.xlsm
    26.8 KB · Views: 13
Back
Top