Sub AX1011()
Dim xR As Range, xE As Range, xF As Range
For Each xR In Range([A!F2], [A!F65536].End(xlUp))
If xR = "" Then GoTo 101
'↓取得B表最後一筆資料位置
Set xE = [B!F65536].End(xlUp)
'↓尋找B表符合值最後一筆位置
Set xF = [B!F:F].Find(xR, After:=xE(2), SearchDirection:=xlPrevious, Lookat:=xlWhole)
'↓若有找到符合值,下方插入一列,並將儲存格變數代換為xE
If Not xF Is Nothing Then xF(2).EntireRow.Insert: Set xE = xF
'↓整列貼至xE的下一列
xR.EntireRow.Copy xE(2).EntireRow
101: Next
End Sub作者: asd1251 時間: 2015-10-11 15:23