|
ゆり さん こんにちは。
下記のようにすれば大丈夫かもしれません。
ただ "Sheet2"のE13を書き換えてしまうので
後で書き直す処理をかかなくてはいけないかも。
Sub test_2()
Dim Ws As Worksheet, Fi As Range, R As Range, C As Range, Ad As String
Set Ws = Worksheets("Sheet2")
Application.ScreenUpdating = False
With Worksheets("Sheet1")
.Range("A1", .Range("A65536").End(xlUp)).AdvancedFilter _
xlFilterCopy, , Ws.Range("E13"), True
Set R = Ws.Range("E14", Ws.Range("E65536").End(xlUp))
For Each C In R
Set Fi = .Columns(1).Find(C.Value, , xlValues, xlWhole)
If Not Fi Is Nothing Then
Ad = Fi.Address
Do
Set Fi = .Columns(1).FindNext(Fi)
Fi.Offset(, 1).Resize(, 4).Copy
C.Offset(, 1).PasteSpecial xlPasteValues, xlPasteSpecialOperationAdd
Loop Until Ad = Fi.Address
End If
Set Fi = Nothing
Next C
Application.CutCopyMode = False
End With
Application.ScreenUpdating = True
Set R = Nothing: Set Ws = Nothing
End Sub
|
|