Private Sub CommandButton2_Click() Dim i&, Myr&, Myc%, Arr, bs1$, xh1$, rq1 Dim r2, xh$, col%, m% Application.ScreenUpdating = False Myr = Sheet1.[a65536].End(xlUp).Row Arr = Sheet1.Range("a2:d" & Myr) Myc = Sheet3.[iv4].End(xlToLeft).Column Range("a5", Cells(24, Myc)).ClearContents bs1 = [a2].Value xh1 = [b2].Value rq1 = [c2].Value m = 4 For i = 1 To UBound(Arr) If Arr(i, 1) = bs1 Then xh = Arr(i, 2) If xh1 <> "" Then If xh1 = xh Then If rq1 <> "" Then If rq1 = Arr(i, 3) Then Set r2 = Sheet3.Rows(4).Find(xh, , , 1) If Not r2 Is Nothing Then col = r2.Column Else col = Sheet3.[iv4].End(xlToLeft).Column + 1 Cells(4, col) = xh End If m = m + 1 Cells(m, 1) = rq1 Cells(m, col) = Arr(i, 4) Else GoTo 100 End If End If End If End If End If 100: Next Application.ScreenUpdating = True End Sub