Book1.rar (10.67 KB)
Sub JPM()
Dim i As Integer, j As Integer, k As Integer, l As Integer
Dim rowC As Integer
Dim rB As Range
Dim data() As String
Dim found As Boolean
'¥ý±N AK:AR ªº¸ê®Æ²M°£
Worksheets("jpm").[A2:O65536].ClearContents
'pºâ¦h¤Öµ§¸ê®Æn³B²z
rowC = Sheets(1).Range("A1").CurrentRegion.Rows.Count
'¥ý¼È¦s¸ê®Æ¡A¥[³t³B²z
Set rB = Sheets(1).Range(Cells(1, 1), Cells(rowC, 32))
ReDim data(rowC, 32)
k = 0
For i = 1 To rowC '³B²z¸ê®Æ
j = 1
found = False
While (j <= k) And (found = False) '¤ñ¹ï¦³¨S¦³¥X²{¹L
If rB(i, 19) = data(j, 19) And rB(i, 20) = data(j, 20) And rB(i, 3) = data(j, 3) Then
found = True
data(j, 3) = rB(i, 3)
data(j, 4) = rB(i, 4)
data(j, 6) = rB(i, 6)
data(j, 19) = rB(i, 19) + "¡B" + rB(i, 19)
data(j, 20) = rB(i, 20) + "¡B" + rB(i, 20)
data(j, 21) = data(j, 21) + "¡B" + rB(i, 21)
data(j, 22) = data(j, 22) + "¡B" + rB(i, 22)
data(j, 23) = data(j, 23) + "¡B" + rB(i, 23)
data(j, 24) = data(j, 24) + "¡B" + rB(i, 24)
data(j, 25) = data(j, 25) + "¡B" + rB(i, 25)
data(j, 26) = data(j, 26) + "¡B" + rB(i, 26)
data(j, 27) = rB(i, 27)
data(j, 28) = rB(i, 28)
data(j, 29) = rB(i, 29)
data(j, 30) = rB(i, 30)
data(j, 31) = rB(i, 31)
data(j, 32) = rB(i, 32)
End If
j = j + 1
Wend
If found = False Then '¨S¦³¥X²{¹L¥[¤J·s¸ê®Æ
k = k + 1
data(k, 3) = rB(i, 3)
data(k, 4) = rB(i, 4)
data(k, 6) = rB(i, 6)
data(k, 19) = rB(i, 19)
data(k, 20) = rB(i, 20)
data(k, 21) = rB(i, 21)
data(k, 22) = rB(i, 22)
data(k, 23) = rB(i, 23)
data(k, 24) = rB(i, 24)
data(k, 25) = rB(i, 25)
data(k, 26) = rB(i, 26)
data(k, 27) = rB(i, 27)
data(k, 28) = rB(i, 28)
data(k, 29) = rB(i, 29)
data(k, 30) = rB(i, 30)
data(k, 31) = rB(i, 31)
data(k, 32) = rB(i, 32)
End If
Next i
l = 1
For i = 1 To k '¦C¦L¸ê®Æ
If Range("B" & i + 1).Value = "JPM" Then
Sheets("JPM").Cells(l, 1) = data(i, 19)
Sheets("JPM").Cells(l, 2) = data(i, 20)
Sheets("JPM").Cells(l, 3) = data(i, 3)
Sheets("JPM").Cells(l, 4) = data(i, 27)
Sheets("JPM").Cells(l, 5) = data(i, 4)
Sheets("JPM").Cells(l, 6) = data(i, 28)
Sheets("JPM").Cells(l, 7) = data(i, 29)
Sheets("JPM").Cells(l, 8) = data(i, 30)
Sheets("JPM").Cells(l, 9) = data(i, 31)
Sheets("JPM").Cells(l, 10) = data(i, 32)
Sheets("JPM").Cells(l, 11) = data(i, 6)
Sheets("JPM").Cells(l, 12) = data(i, 21) + "¡B" + data(i, 22) + "¡B" + data(i, 23)
Sheets("JPM").Cells(l, 13) = data(i, 24)
Sheets("JPM").Cells(l, 14) = data(i, 25)
Sheets("JPM").Cells(l, 15) = data(i, 26)
End If
l = l + 1
Next i
MsgBox ("Sucess")
End Sub
¦p¦ó¥i¥HÅý¤£¬O"JPM"¤£Åã¥Ü¥X¨Ó¡A¤]¤£·|¯d¤@¦æªÅ®æ¡H |