メインコンテンツへスキップ

Excelでセルにゼロが含まれている場合に行全体を削除するにはどうすればよいですか?

Excelでセルにゼロが含まれている場合は行全体を削除したい場合があり、セルの数が少ない場合はXNUMXつずつ削除できます。 しかし、ゼロを含む何百もの行を削除する必要があるのはどうですか? あなたはそれを解決するために以下のトリッキーな方法のXNUMXつを選ぶことができます。

Excelのフィルター機能でセルにゼロが含まれている場合は行を削除します
ExcelのVBAでセルにゼロが含まれている場合は行を削除します
Kutools for Excelでセルにゼロが含まれている場合は、行を削除します


Excelのフィルター機能でセルにゼロが含まれている場合は行を削除します

フィルタ機能を使用して、特定の列のゼロ値に基づいてすべての行を除外し、後で表示されているすべての行を削除できます。 次のようにしてください。

1.行全体を削除するゼロ値を含む列セルを選択し、をクリックします 且つ > フィルタ。 スクリーンショットを参照してください:

2.次に、選択した列の最初のセルにドロップダウン矢印が表示されます。矢印をクリックして、[ 数値フィルター > 等しいです ドロップダウンリストから選択します。

ゼロの場合はドキュメントを削除1

3。 の中に カスタムオートフィルター ダイアログボックスに番号を入力 0 以下のスクリーンショットのようにテキストボックスに入力し、[ OK

ゼロの場合はドキュメントを削除1

4.次に、この特定の列のすべてのゼロ値セルが除外されます。 フィルタ範囲内のすべての表示セルを選択して右クリックし、を選択してください 行の削除 右クリックメニューから。 そして、ポップアッププロンプトボックスで、をクリックします OK ボタン。 スクリーンショットを参照してください:

ゼロの場合はドキュメントを削除1

5.これで、表示されているすべての行が削除されます。 クリックできます 且つ > フィルタ 再び、ゼロ値セルのないすべてのデータを表示します。 スクリーンショットを参照してください:

ゼロの場合はドキュメントを削除1


Excelの特定の範囲にゼロ値が存在する場合、すべての行を簡単に削除できます。

Excel用のKutools 特定のセルを選択 ユーティリティを使用すると、特定の範囲にゼロ値が存在する場合に行全体を簡単に選択でき、選択したすべての行を間違いなく手動ですばやく削除できます。
今すぐダウンロードして試してください! (30日間の無料トレイル)


ExcelのVBAでセルにゼロが含まれている場合は行を削除します

このセクションでは、Excelの特定の列にゼロ値が存在する場合にすべての行を削除するVBAメソッドについて説明します。

1。 押す Altキー+ F11 キーを同時に表示して アプリケーション向け Microsoft Visual Basic 窓。

2. [Microsoft Visual Basic for Applications]ウィンドウで、[ インセット > モジュール、次に、次のVBAコードをコピーしてモジュールウィンドウに貼り付けます。

VBA:ワークシートの特定の列範囲にゼロ値が存在する場合は、行全体を削除します

Sub DeleteZeroRow() 'Updateby20140616 Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox( "Range"、xTitleId、WorkRng.Address、Type:= 8 )Application.ScreenUpdating = False Do Set Rng = WorkRng.Find( "0"、LookIn:= xlValues)If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True End Sub

3。 プレス F5 ポップアップでコードを実行するためのキー Kutools for Excel ダイアログボックスで、内部のゼロ値に基づいて行全体を削除する列範囲を選択し、[ OK ボタン。 スクリーンショットを参照してください:

ゼロの場合はドキュメントを削除1

次に、指定された列範囲のゼロ値に基づくすべての行がすぐに削除されます。

ゼロの場合はドキュメントを削除1


Kutools for Excelでセルにゼロが含まれている場合は、行を削除します

多くのExcelユーザーにとって、VBAコードを使用してExcelのデータを削除することは危険です。 VBAコードを正確に信頼していない場合は、ここで試してみることをお勧めします。 特定のセルを選択 の有用性 Kutools for Excel.

申請する前に Kutools for Excelについては 最初にダウンロードしてインストールします.

1.内部のゼロ値に基づいて行全体を削除する列範囲を選択し、[ クツール > 選択 > 特定のセルを選択。 スクリーンショットを参照してください:

2。 の中に 特定のセルを選択 ダイアログでは、次のことを行う必要があります。

(1)を選択します 行全体 内のオプション 選択タイプ のセクションから無料でダウンロードできます。

(2)選択 等しいです 最初に 特定のタイプ ドロップダウンリスト、次に番号を入力します 0 テキストボックスに。

(3)をクリックします OK

3.選択した行数を示すダイアログボックスが表示されたら、[ OK ボタン。 これで、指定した列範囲にゼロ値が存在するすべての行が選択されます。 選択した行を右クリックして、クリックしてください 削除 右クリックメニューで。 スクリーンショットを参照してください:

ゼロの場合はドキュメントを削除1

これで、指定した列にゼロ値が存在するすべての行がすぐに削除されます。 スクリーンショットを参照してください:

ゼロの場合はドキュメントを削除1

  このユーティリティの無料トライアル(30日)が必要な場合は、 クリックしてダウンロードしてください、次に、上記の手順に従って操作を適用します。


Kutools for Excelでセルにゼロが含まれている場合は、行を削除します


関連記事:

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Despues de utilizar subtotal Como hacer para eliminar las filas involucradas que en el subtotal es igual a 0?
This comment was minimized by the moderator on the site
Insert this in VB new module.
This is with InputBox to delete row which contains that word.

Attribute VB_Name = "FindDelRowByWord"
Sub FindDelRow()
'Updateby20140616
Dim Rng As Range
Dim WorkRng As Range
Dim xRep As String
On Error Resume Next
xTitleId = "ZOK Tools"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xRep = Application.InputBox("word to delete Row:", "ZOK Tools", , , , , 2)
Application.ScreenUpdating = False
Do
Set Rng = WorkRng.Find(xRep, LookIn:=xlValues)
If Not Rng Is Nothing Then
Rng.EntireRow.Delete
End If
Loop While Not Rng Is Nothing
Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
WHAT IF you have a big sheet, and there are rows you want to keep, and others rows that contain certain key words and delete those? the kutools work for me but for one key word that many rows have that key word, the rows were deleted, i just want to have multiple key words to do the same? does this work for the code above?
This comment was minimized by the moderator on the site
Good Day,
Kutools can deal with two key words at the same time. You need to enable its second condition with "And" or "Or". Hope I can help.
This comment was minimized by the moderator on the site
This didn't work for me. It changed all values in my chosen column and the adjacent column to zeros. I must be doing something wrong!
This comment was minimized by the moderator on the site
Hi Sheri,
The code works well in my case. Which Excel verson do you use?
This comment was minimized by the moderator on the site
Hi Crystal. I posted this two years ago so I’m guessing I figured it out. But thanks for the reply.
This comment was minimized by the moderator on the site
Hi dears , I need a code to hide the rows which have the value=0 on the column "N" in the sheet 1. The value of the column "N" will change when update the details on the Sheet 2. that's the time need to un-hide the row. is this possible to do this with Excel formula(without macro and Excel Filters).
This comment was minimized by the moderator on the site
modified for my purpose--thank you for your help: Sub DeleteZeroRow() Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "" Application.Calculation = xlManual MsgBox "Set the range you want to remove the unused 0 quantity rows from" Set WorkRng = Application.InputBox("Range", xTitleId, "FG93:FG500", Type:=8) Application.ScreenUpdating = False Sheets("ENTRY").Select Do Set Rng = WorkRng.Find("0", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True Range("FF92").Select Selection.End(xlDown).Select MsgBox "Removed 0's ROWS from column FG--calculating now--please wait" Application.Calculation = xlAutomatic End Sub
This comment was minimized by the moderator on the site
I modified the below code to work for me. This deleted every row in column C that had "Delete" in the cell of column C. Sub Delete_DeleteRows() Set WorkRng = Range("C2:C12000") Application.ScreenUpdating = False Do Set Rng = WorkRng.Find("Delete", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True End Sub
This comment was minimized by the moderator on the site
Hi,
its worked for me, thanks a lot.
if I have multiple sheets? how i can run the script 1 time for all the sheets?
This comment was minimized by the moderator on the site
thanks for the response, worked for me
This comment was minimized by the moderator on the site
I modified the above code to work for me. I wanted to delete every row that had "Delete" in row C. Sub Delete_DeleteRows() Set WorkRng = Range("C2:C12000") Application.ScreenUpdating = False Do Set Rng = WorkRng.Find("Delete", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True End Sub
This comment was minimized by the moderator on the site
Your VB code doesn't work. It deletes all rows with a Zero in the 10s position. I hope no one actually uses this as they will delete data...
This comment was minimized by the moderator on the site
This was a life saver!!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations