マクロの書き直しをお願いします。 条件…データは無数にあって、重複するデータが複数存在する 列 B、F、G、I、J、L、Z、AA が一致する行を探して、一致する行が見つかった場合 その複数行に対して次の条件をつける P-V列には●がランダムに入っており、よりP列側に●が入ってる行を残し他の行は削除する。 例、一致した行が10行あり、3行目のP列に●があれば他の行を削除 P列になければQ列をみてのように、V列まで行う 見つかり、削除したらループから抜ける もし同じ列に●があればある行を残し他は削除 以上お願いいたします。 Sub 行削除2() Dim ws As Worksheet Dim lastRow As Long Dim i As Long, j As Long Dim kanri As String, main As String, season As String, day As String Dim Time As String, typ As String, No As String, Name As String Dim hasFound As Boolean Set ws = ThisWorkbook.Sheets("収集all") lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row For i = 2 To lastRow kanri = ws.Cells(i, "B").Value main = ws.Cells(i, "F").Value season = ws.Cells(i, "G").Value day = ws.Cells(i, "I").Value Time = ws.Cells(i, "J").Value typ = ws.Cells(i, "L").Value No = ws.Cells(i, "Z").Value Name = ws.Cells(i, "AA").Value hasFound = False For j = i + 1 To lastRow If ws.Cells(j, "B").Value = kanri And ws.Cells(j, "F").Value = main And _ ws.Cells(j, "G").Value = season And ws.Cells(j, "I").Value = day And _ ws.Cells(j, "J").Value = Time And ws.Cells(j, "L").Value = typ And _ ws.Cells(j, "Z").Value = No And ws.Cells(j, "AA").Value = Name Then For k = 16 To 23 If ws.Cells(i, k).Value = "●" Then If ws.Cells(j, k).Value <> "●" Then ws.Rows(j).Delete lastRow = lastRow - 1 j = j - 1 End If Else If ws.Cells(j, k).Value = "●" Then If ws.Cells(i, k).Value <> "●" Then ws.Rows(i).Delete lastRow = lastRow - 1 Exit For End If End If End If Next k End If Next j Next i End Sub 文字数の関係で醜いですがお願いいたします。
Visual Basic