1Sub sample()
2 Dim shSrc As Worksheet
3 Dim shDst As Worksheet
4 Dim srcRng As Variant
5 Dim fc As Range
6 Dim r As Long
7 Dim last As Long
89 Set shSrc = Worksheets("Sheet1")
10 Set shDst = Worksheets("Sheet2")
1112 srcRng = shSrc.Range("A1").CurrentRegion
1314 For r = 2 To UBound(srcRng)
15 If InStr(srcRng(r, 1), "PGA") > 0 Then
16 With shDst
17 Set fc = .Range("A:A").Find(srcRng(r, 1))
18 If fc Is Nothing Then
19 last = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
20 If last = 2 Then last = 3
21 .Cells(last, 1) = srcRng(r, 1)
22 .Cells(last, 2) = srcRng(r, 3)
23 .Cells(last, 3) = srcRng(r, 3)
24 .Cells(last, 4) = srcRng(r, 4)
25 .Cells(last, 5) = srcRng(r, 4)
26 Else
27 If .Cells(fc.Row, 2) < srcRng(r, 3) Then .Cells(fc.Row, 2) = srcRng(r, 3)
28 If .Cells(fc.Row, 3) > srcRng(r, 3) Then .Cells(fc.Row, 3) = srcRng(r, 3)
29 If .Cells(fc.Row, 4) < srcRng(r, 4) Then .Cells(fc.Row, 4) = srcRng(r, 4)
30 If .Cells(fc.Row, 5) > srcRng(r, 4) Then .Cells(fc.Row, 5) = srcRng(r, 4)
31 End If
32 End With
33 End If
34 Next
3536End Sub
37