2012-09-15 03:05:46 +0000 2012-09-15 03:05:46 +0000
24
24
Advertisement

エクセルです。特定の列のセルが空白の場合、行を削除しますか?

Advertisement

私はExcelの全くの初心者なので、簡単にできることであればお許しください。私は多くのオプションを探しましたが、私が必要とするものを見つけることができませんでした。

基本的に、私は列Cに値を含まないすべての行を削除したいのですが、これを行うにはどうしたらいいでしょうか?

私は今、5000以上の製品のために手動でこれを行っていますが、それは私を狂わせています。

Advertisement
Advertisement

回答 (4)

34
34
34
2012-09-15 06:08:10 +0000

セルが本当に空白の場合は、SpecialCells

Manual

  • Select Column C
  • Press F5, then Special
  • Check Blanks, then OK (下の写真のこのステップを参照してください)
  • Delete the rows that now selected (e.g. 例: 右クリックして選択した行を削除します(例: 右クリックして選択した行を削除します)

VBA

Sub QuickCull()
    On Error Resume Next
    Columns("C").SpecialCells(xlBlanks).EntireRow.Delete
End Sub

9
9
9
2012-09-15 03:41:57 +0000

ここでは簡単な手動の方法

  1. シートに Auto Filter を適用する
  2. 列のフィルター C 空白
  3. すべての目に見える行を選択して下さい
  4. 行の削除 5.フィルタの削除

このプロセスは、必要に応じてVBAで自動化することができます。スタートを得るためにマクロレコーダーを実行してみてください

0
Advertisement
0
0
2016-02-19 16:18:47 +0000
Advertisement

これはうまくいくはずです。

-1
-1
-1
2015-03-22 11:48:37 +0000

このコードをシートモジュール(右マウスでシートタブをクリックして「コードを表示」を選択)に入れることができます:

Sub Delete_Blank_Rows()

'Deletes the entire row within the selection if the ENTIRE row contains no data.

'We use Long in case they have over 32,767 rows selected.

Dim i As Long
Dim LastRow As Integer

'We turn off calculation and screenupdating to speed up the macro.

 With Application
     .Calculation = xlCalculationManual
     .ScreenUpdating = False

     'Reduce the work on the calc and define the range

     LastRow = Range("A" & Rows.Count).End(xlUp).Row
     Range("A2:A" & LastRow).Select

     'We work backwards because we are deleting rows.

     For i = Selection.Rows.Count To 1 Step -1
          If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
              Selection.Rows(i).EntireRow.Delete
          End If
     Next i

    .Calculation = xlCalculationAutomatic
    .ScreenUpdating = True
End With

End Sub
``` &001
Advertisement

関連する質問

6
6
13
9
10
Advertisement