How to make combobox and Textbox join together for application.match

HYKE

Active Member
Joined
Jan 31, 2010
Messages
373
Hi There,

Can somebody help for a VBA code for combobox and textbox as reference for application.match?

This is the code I have for extracting the data from the worksheet to userform
Code:
Dim prodfound As Range
    With Worksheets("BPME").Range("G:G")
        Set prodfound = .Find(shptUpdate.Value)
        
        If prodfound Is Nothing Then
            MsgBox ("ITEM NOT FOUND!")
            shptUpdate.Value = ""
            Exit Sub
            
        Else
            With Range(prodfound.Address)
            frmUpdate.ductName.Text = .Offset(0, -3)
            frmUpdate.BLNo.Text = .Offset(0, 1)
            frmUpdate.sPlier.Text = .Offset(0, 3)
            frmUpdate.voiNum.Text = .Offset(0, 5)
            frmUpdate.qTy.Text = .Offset(0, 6)
            dateshptRec.Text = .Offset(0, 14)
            Mritr.Text = .Offset(0, 16)
            End With
        End If
     End With

where shptUpdate is a combobox looking for the partnumber from range ("G:G") and BLNo is a textbox extracting the serial number for the partnumber. Now, I have other sheet where I will have to update basing on the shptUpdate (combobox) and BLNo (textbox) data. The VBA code is the code that was provided to me here a year ago. The red ones is my addition that don't work.

Code:
Dim BpRow As Long
Dim bpPart As Long
Dim Bps As Worksheet
Set Bps = Worksheets("BPME")
    With Us
         r = Application.Match([COLOR=red]shptUpdate.Value & BlNo.value[/COLOR], .Range("G:G"), False)
        .Cells(r, 21).Value = shptRec.Value
        .Cells(r, 22).Value = jdePo.Value
        .Cells(r, 23).Value = ovNum.Value
        .Cells(r, 25).Value = recQty.Value
        .Cells(r, 26).Value = lNum.Value
        '.Cells(r, 26).Value = .Cells(r, 14).Value + Val(TextBox14.Value)
        '.Cells(r, 27).Value = .Cells(r, 15).Value + Val(TextBox15.Value)
        '.Cells(r, 28).Value = .Cells(r, 16).Value + Val(TextBox16.Value)
        .Cells(r, 32).Value = reMrks.Value
        shptRec.Value = ""
        jdePo.Value = ""
        ovNum.Value = ""
        recQty.Value = ""
        lNum.Value = ""
        reMrks.Value = ""
        'TextBox16.Value = ""
        'TextBox9.Value = ""
        'Range("a1").Select
       
    End With

The reason why I need to have two reference is because I have duplicate partnumbers but different serial numbers. I tried using the partnumber as my only reference but when there is a duplicate partnumber down the column, the one that gets updated is always the first on the list. I really need help here as I am almost done except for this. Thanks again for all of your help/assistance

HYKE
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Are you trying to use Match when the values you are looking for are in separate columns?

If you are you can't.

Why not use a find for the part number, check if the serial number in the same row matches the one you are looking for.

If it isn't search for the next occurrence of the part no, check the serial no again.

Repeat until you find a matching serial no or you've gone through all the part numbers.

How exactly to do that depends on how the data is setup.
 
Upvote 0
Hi Norie,

Will you kindly provide me a code for this suggestion of yours?
Code:
Why not use a find for the part number, check if the serial number in the same row matches the one you are looking for.

If it isn't search for the next occurrence of the part no, check the serial no again.

Repeat until you find a matching serial no or you've gone through all the part numbers.

The part number is in G column while the serial number in H.

Thank you for your time.

HYKE
 
Upvote 0
HYKE

I think a little more information would be needed.

Are the serial numbers in a contiguous list?

eg in H10:H20 you have the same serial number and in the corresponding rows of column G you have the part numbers.
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,919
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top