✔ 最佳答案
用您的資料改一下
Dim Cdata(1 To 50, 1 To 6)
Dim Rdata%
For A = 5 To Cells(Rows.Count, 1).End(xlUp).Row
CName = Cells(2, 3)
Phone = Cells(2, 4)
BthDate = Cells(2, 5)
If CName = "" Then CName = Cells(A, 3)
If Phone = "" Then Phone = Cells(A, 4)
If BthDate = "" Then BthDate = Cells(A, 5)
If Cells(A, 3) = CName And Cells(A, 4) = Phone And Cells(A, 5) = BthDate Then
Countcolumn = Cells(A, Columns.Count).End(xlToLeft).Column
Rdata = Rdata + 1
For b = 1 To Countcolumn
Cdata(Rdata, b) = Cells(A, b)
Next
End If
Next
[h4].Resize(A, 6) = Cdata