Worksheetfunction.Match

johnsonk

Board Regular
Joined
Feb 4, 2019
Messages
172
Hi, The issue I am having is textbox1 (Top Label Code) finds the exact match from column A but there is more than one so it matches the first one in column A, how could I do it so it matches column A and column G?

As you can see from the image below I selected product code 8696 but it put the data in 8691 the first match in column A from textbox1 (Top Label Code).

I have tried to change the match to ComboBox3 (Product Code) column G but it shows an error, how could I do it so it matches column A and column G or just column G.

Hope that made some sense.☺

ComboBox8 is (QTY)

VBA Code:
Private Sub ComboBox8_AfterUpdate()

Dim m As Variant

 With ThisWorkbook.Worksheets("ALL")

 m = WorksheetFunction.Match(TextBox1.Text, .Columns(1), 0)

 If ComboBox1.Value = "OUT" Then
 
   With .Cells(CLng(m), "I")
   
 .Value = ""
 
 .Value = .Value + ComboBox2.Value

 End With

 With .Cells(CLng(m), "J")

 .Value = .Value + ComboBox8.Value
 
 End With
 
  sl1.Show
 
 ElseIf ComboBox1.Value = "IN" Then
 
  With .Cells(CLng(m), "I")
 
 .Value = ""
 
  End With

 With .Cells(CLng(m), "J")

 .Value = .Value - ComboBox8.Value
  
 sl1.Show

 End With
 End If
 End With
End Sub

1644924163172.png
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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