Sub Button1_Click()
Dim sh As Worksheet, sArr(), Res()
Dim dk, dk2, sRow&, i&, j&, t&, t2&, k&, S
Dim chk As Boolean, chk2 As Boolean
With Sheets("result2")
dk = .Range("A2").Value: dk2 = .Range("B2").Value
If dk = Empty Or dk2 = Empty Then Exit Sub
If dk = dk2 Then Exit Sub
End With
ReDim Res(1 To 10000, 1 To 6)
For Each sh In ActiveWorkbook.Worksheets
If IsNumeric(sh.Name) Then
i = sh.Range("E60000").End(xlUp).Row
If i >= 2 Then
sArr = sh.Range("A2:E" & i).Value
sRow = UBound(sArr)
For i = 1 To sRow
t = 0: t2 = 0
For j = 2 To 5
If sArr(i, j) = dk Then t = 1
If sArr(i, j) = dk2 Then t2 = 1
Next j
If t + t2 = 2 Then
k = k + 1
For j = 1 To 5
Res(k, j) = sArr(i, j)
Next j
S = Split(sArr(i, 1), "/")
Res(k, 6) = DateValue("2000/" & S(1) & "/" & S(0))
End If
Next i
End If
End If
Next sh
Application.EnableEvents = False
Application.ScreenUpdating = False
With Sheets("conclu")
i = .Range("D" & Rows.Count).End(xlUp).Row
If i > 1 Then .Range("D2:H" & i).ClearContents
If k Then
.Range("D2").Resize(k).NumberFormat = "@"
.Range("D2").Resize(k, 6) = Res
.Range("D2").Resize(k, 6).Sort .Range("I2"), xlAscending, Header:=xlNo
.Range("I2").Resize(k).ClearContents
End If
End With
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub