こんばんは!
一例です。
↓の画像で左側がSheet1で右側がSheet2とします。
尚、Sheet3を作業用のSheetとして使用していますので、Sheet3は全く使用していない状態にしておいてください。
標準モジュールです。
Sub Sample1()
Dim i As Long, cnt As Long, endRow As Long, wS1 As Worksheet, wS2 As Worksheet, wS3 As Worksheet
Set wS1 = Worksheets("Sheet1")
Set wS2 = Worksheets("Sheet2")
Set wS3 = Worksheets("Sheet3")
Application.ScreenUpdating = False
wS2.Cells.ClearContents
wS1.Range("A:A").AdvancedFilter Action:=xlFilterInPlace, unique:=True
wS1.Range("A:A").Copy wS3.Range("A1")
wS3.Range("A:A").Sort key1:=wS3.Range("A1"), order1:=xlAscending, Header:=xlYes
wS1.ShowAllData
For i = 2 To wS3.Cells(Rows.Count, "A").End(xlUp).Row
wS1.Range("A1").CurrentRegion.AutoFilter field:=1, Criteria1:=wS3.Cells(i, "A")
wS1.Range("B:F").Copy wS3.Range("B1")
endRow = wS3.Cells(Rows.Count, "B").End(xlUp).Row
Range(wS3.Cells(1, "B"), wS3.Cells(endRow, "F")).Sort key1:=wS3.Range("B1"), order1:=xlAscending, Header:=xlYes, _
key2:=wS3.Range("C1"), order1:=xlAscending, Header:=xlYes
wS3.Range("B1") = wS3.Cells(i, "A")
endRow = wS3.Cells(Rows.Count, "B").End(xlUp).Row
If wS2.Cells(Rows.Count, "A").End(xlUp).Row > 1 Then
cnt = wS2.Cells(Rows.Count, "A").End(xlUp).Row + 1
Else
cnt = 1
End If
Range(wS3.Cells(1, "B"), wS3.Cells(endRow, "F")).Copy wS2.Cells(cnt, "A")
Next i
With wS2.Range("A:A")
.Replace what:=1, replacement:="男性", lookat:=xlWhole
.Replace what:=2, replacement:="女性", lookat:=xlWhole
End With
wS1.AutoFilterMode = False
wS3.Cells.Clear
Application.ScreenUpdating = True
MsgBox "処理完了"
End Sub
こんな感じではどうでしょうか?m(_ _)m
お礼
理想に近い形ができました!ありがとうございました!