hello
I have this code but it's very slow if anybody has make shorter by using array I truly appreciate
I have this code but it's very slow if anybody has make shorter by using array I truly appreciate
VBA Code:
Private Sub CommandButton1_Click()
Dim ws As Worksheet, matchFormula1, matchFormula2, matchFormula13 As String, cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9 As String
Set ws = Sheets("Sheet1")
cb1 = ComboBox1.Text
cb2 = ComboBox2.Text
cb3 = ComboBox3.Text
cb4 = ComboBox4.Text
cb5 = ComboBox5.Text
cb6 = ComboBox6.Text
cb7 = ComboBox7.Text
cb8 = ComboBox8.Text
cb9 = ComboBox9.Text
matchFormula1 = "match(" & Chr(34) & cb1 & cb2 & cb3 & Chr(34) & ",A:A&B:B&C:C,0)"
matchFormula2 = "match(" & Chr(34) & cb4 & cb5 & cb6 & Chr(34) & ",A:A&B:B&C:C,0)"
matchFormula3 = "match(" & Chr(34) & cb7 & cb8 & cb9 & Chr(34) & ",A:A&B:B&C:C,0)"
On Error Resume Next
ws.Cells(Evaluate(matchFormula1), ws.Columns.Count).End(xlToLeft).Offset(, 1) = TextBox1.Value
ws.Cells(Evaluate(matchFormula2), ws.Columns.Count).End(xlToLeft).Offset(, 1) = TextBox2.Value
ws.Cells(Evaluate(matchFormula3), ws.Columns.Count).End(xlToLeft).Offset(, 1) = TextBox3.Value
On Error GoTo 0
End Sub