| 
    
     |  | ▼武蔵 さん: >初めまして。マクロ初心者のため、皆様のお力をお貸しください。
 >罫線(セル下の実線)と罫線(セル下の実線)に囲まれているデータを
 >1つのグループとしてみて、
 >重複しているグループを除いて抽出したいのです。
 >しかも、行数は必ず2行とは限らないのです…
 
 こんにちは。
 こんな感じでしょうか
 
 
 Sub TEST()
 Dim v1 As Variant
 Dim v2 As Variant
 Dim i  As Long
 Dim j  As Long
 Dim k  As Long
 Dim Dic As Object
 
 Set Dic = CreateObject("Scripting.Dictionary")
 With Worksheets(1)
 For i = 1 To .Range("A" & .Rows.Count).End(xlUp).Row
 v1 = .Range(.Cells(i, 1), .Cells(i, 3)).Value
 v1 = Application.Index(v1, 0)
 v2 = v2 & Join(v1, ",") & vbCrLf
 If .Cells(i, 1).Borders(xlEdgeBottom).LineStyle = xlContinuous Then
 Dic(v2) = Empty
 v2 = ""
 End If
 Next
 End With
 v1 = Dic.Keys
 With Worksheets(2)
 .Cells.Clear
 For i = 0 To UBound(v1)
 v2 = Split(v1(i), vbCrLf)
 For j = 0 To UBound(v2) - 1
 k = k + 1
 .Cells(k, 1).Resize(, 3).Value = Split(v2(j), ",")
 If j = UBound(v2) - 1 Then
 With .Cells(k, 1).Resize(, 3).Borders(xlEdgeBottom)
 .LineStyle = xlContinuous
 .Weight = xlThin
 .ColorIndex = xlAutomatic
 End With
 End If
 Next
 Next
 End With
 End Sub
 
 
 |  |