VBAの行削除の処理速度に関する質問です。 VBAで行を削除するコードを作成しましたが、処理速度が遅く、困っています。 添付資料のSheet1は ある商品の製造工程と作業時間を抽出したCSVデータで他の商品のデータも同様に このSheet1の10000行近くまであります。 このデータから工程ごとの作業時間を集計するためにSheet2で工程1のように G列の数字があるとき、行を削除するようにしたのですが、処理が遅すぎて、もっと速くできるコードがわかる方教えてください。 使っているVBAコードは下にあります。 下のコードではG列に数字が「3」と「5」がある場合のコードですが 「3」と「6」、「3」と「7」・・・・・・・「3」と「15」がある場合も 別ワークブックで作成しますので、これを加味してください。 また空白行削除の処理速度が速いコードも教えてください。 よろしくお願いいたします。 Sub RowDelete1() Dim i As Long Dim lastrow As Long Dim ws1 As Worksheet Set ws1 = ThisWorkbook.Worksheets("Sheet1") lastrow = ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row For i = 1 To lastrow If ws1.Cells(i, 7) = "1" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "2" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "4" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "6" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "7" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "8" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "9" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "10" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "11" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "12" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "13" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "14" Then Rows(i).Delete End If If ws1.Cells(i, 7) = "15" Then Rows(i).Delete End If Next i End Sub