A~EÄ椺,¦P¤@¦C¤¤BÄæ»PDÄæ¤ñ¸û/CÄæ»PEÄæ¤ñ¸û,±N¤£¤@¼Ëªº½Æ»s¨ìM~QÄæ
½Ð°Ý¦p¦ó¥ÎVBA°õ¦æ
A B C D E
1 0 aa 0 aa
2 1 bb 2 cc
3 1 dd 1 dd
4 2 zz 2 zz
5 6 aa 7 aa
¤w¸Ñ¨M,ÁÂÁ¤j®a
Sub Ex()
Dim Ay(4), Ary(), C As Range
With Sheets(1)
For Each C In .Range(.[a2], .[a2].End(xlDown))
If .Cells(C.Row, 3) <> .Cells(C.Row, 5) Or .Cells(C.Row, 4) <> .Cells(C.Row, 6) Then
Ay(0) = .Cells(C.Row, 1): Ay(1) = .Cells(C.Row, 2): Ay(2) = .Cells(C.Row, 3): Ay(3) = .Cells(C.Row, 4)
Ay(4) = .Cells(C.Row, 5)
ReDim Preserve Ary(s)
Ary(s) = Ay
Erase Ay: s = s + 1
End If
Next
End With
Sheets(1).Range("m1:q65526").Clear
Sheets(1).[m1].Resize(s, 5) = Application.Transpose(Application.Transpose(Ary))
End Sub