▽1
●
a-kuma3 ●300ポイント ベストアンサー |
こんな感じでどうでしょう。
Function is_blank_cell(c) is_blank_cell = IsEmpty(c) Or c.Value = "" End Function Sub condense_table() start_row = 200 ' 圧縮範囲の開始行 For col = 1 To 7 Step 2 ' A, C, E, G 列 last_row_1 = Cells(Rows.Count, col).End(xlUp).Row last_row_2 = Cells(Rows.Count, col + 1).End(xlUp).Row If last_row_1 > last_row_2 Then last_row = last_row_1 Else last_row = last_row_2 End If For r = last_row To start_row Step -1 If is_blank_cell(Cells(r, col + 1)) Then Range(Cells(r, col), Cells(r, col + 1)).Delete Shift:=xlUp End If Next Next End Sub
対象のシートを選択した状態で、condense_table サブルーチンを実行してください。