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

Wordのテーブルから空の行と列を削除するにはどうすればよいですか?

Wordのテーブルからすべての空の行と列を削除するにはどうすればよいですか? このチュートリアルでは、Word文書のテーブルから空の行と列を削除するいくつかの方法を示します。

テーブルからすべての空の行と列を手動で削除します

VBAコードを使用して、テーブルからすべての空の行と列を削除します

ワンクリックでテーブルからすべての空の行と列を削除します良いアイデア3


テーブルからすべての空の行と列を手動で削除します

Microsoft Office Wordには、空の行と列を削除する便利な方法がありません。空の行と列を手動で選択してから、XNUMXつずつ削除する必要があります。

手順1:削除する空の行または空の列を選択します。 スクリーンショットを参照してください:

doc-removerowsandcols-1

ステップ3:下 ツールをクリックし、 レイアウト タブ;

doc-removerowsandcols-2

ステップ4: 行と列 グループをクリック 行の削除 または列を削除します.

doc-removerowsandcols-3


VBAコードを使用して、テーブルからすべての空の行と列を削除します

Wordのマクロ機能は、ドキュメント内のテーブルからすべての空の行と列を削除するためのはるかに便利な方法を提供します。 次のようにして、空の行と列をすべて削除できます。

ステップ1:プレス 「Alt-F11」 Microsoft Visual Basic forApplicationウィンドウを開きます。

ステップ2:クリック モジュール インセット タブをクリックし、次のVBAコードをコピーしてモジュールウィンドウに貼り付けます。

ステップ3:次にクリック ランdoc-逆符号-6 ボタンを押してVBAを適用します。

テーブルからすべての空の行と列を削除するVBAコード:

サブDeleteEmptyTablerowsandcolumns()
Application.ScreenUpdating = False
Dim Tbl As Table、cel As Cell、i As Long、n As Long、fEmpty As Boolean
ActiveDocumentを使用
.Tablesの各Tblについて
n = Tbl.Columns.Count
i = n から 1 ステップ -1 の場合
fEmpty = 真
Tbl.Columns(i).Cellsの各セルについて
Len(cel.Range.Text)> 2の場合
fEmpty = 偽
終了
終了する場合
次のセル
fEmpty = Trueの場合Tbl.Columns(i).Delete
私は次の
次のTbl
最後に
ActiveDocumentを使用
.Tablesの各Tblについて
n = Tbl.Rows.Count
i = n から 1 ステップ -1 の場合
fEmpty = 真
Tbl.Rows(i).Cellsの各セルについて
Len(cel.Range.Text)> 2の場合
fEmpty = 偽
終了
終了する場合
次のセル
fEmpty = Trueの場合Tbl.Rows(i).Delete
私は次の
次のTbl
最後に
Set cel = Nothing:Set Tbl = Nothing
Application.ScreenUpdating = True
End Subの


ワンクリックでテーブルからすべての空の行と列を削除します

Kutools for Wordは、ドキュメント内のテーブルからすべての空の行と列を削除するための最も便利な方法を提供します。 一度クリックするだけで、 Kutools for Word〜の Delete Rows/Columns ユーティリティは、すべてのテーブルまたは選択されたテーブルからすべての空の行と列をすばやく削除します。

Kutools for Word, 以上で  便利な機能で、仕事が楽になります。 

インストールした後 Kutools for Word、以下のようにしてください:(今すぐWord用のKutoolsを無料でダウンロードしてください!)

1。 クリック クツールズプラス > Delete Rows/Columns Table ペイン。

docはテーブル1から空白行の列を削除します

2.次にダイアログが表示され、[探す場所]セクションでテーブルを削除するスコープを選択し、[チェックイン]をオンにします。 オプション 空白行 オプション、またはチェック コラム オプション 空白行 必要に応じてオプション。 空白の行と列をすべて削除する場合は、この操作をXNUMX回適用する必要があります。

dockutoolsは空白行を削除します2  dockutoolsは空白行を削除します3 

これで、処理されたテーブルの数を通知するダイアログが表示されます。をクリックします。 OK を閉じ、空白の行と列がテーブルから削除されました。
dockutoolsは空白行を削除します4

ヒント。Excelシートから空白行を削除する場合は、 空白行を削除する Kutools forExcelのユーティリティが役に立ちます。

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

Kutools for Word - Over で単語体験を向上させましょう 100 注目すべき機能!

🤖 Kutools AI アシスタント: AI であなたの文章を変革します - コンテンツを生成する  /  テキストを書き換える  /  文書を要約する  /  情報のお問い合わせ 文書に基づいて、すべて Word 内で

📘 ドキュメントマスタリー: 分割ページ  /  ドキュメントをマージする  /  選択内容をさまざまな形式でエクスポート (PDF/TXT/DOC/HTML...)  /  PDFへの一括変換  /  ページを画像としてエクスポート  /  複数のファイルを一度に印刷する...

コンテンツ編集: バッチ検索と置換 複数のファイルにわたる  /  すべての画像のサイズを変更する  /  テーブルの行と列を転置する  /  表をテキストに変換...

🧹 楽にお掃除:振り払って 余分なスペース  /  セクションブレーク  /  すべてのヘッダー  /  テキストボックス  /  ハイパーリンク  / その​​他の取り外しツールについては、当社の Web サイトをご覧ください。 グループを削除...

クリエイティブインサート:挿入 千の区切り文字  /  チェックボックス  /  ラジオボタン  /  QRコード  /  バーコード  /  斜線テーブル  /  方程式のキャプション  /  画像キャプション  /  テーブルキャプション  /  複数の写真  / 詳細については、 グループを挿入...

🔍 正確な選択: ピンポイント 特定のページ  /  テーブル  /  シェイプ  /  見出し段落  / ナビゲーションを強化する 他には? 機能の選択...

スターの強化: あらゆる場所に素早く移動  /  繰り返しのテキストを自動挿入  /  ドキュメントウィンドウをシームレスに切り替える  /  11 変換ツール...

👉 これらの機能を試してみませんか? Kutools for Wordは、 60日無料トライアル、制限なし! 🚀
 
Comments (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi
Many many thanks. Its 100% worked.
This comment was minimized by the moderator on the site
Hi, thanks for the CODE, it worked on a document with only one table.

but when launching it on a word document with different tables from different sizes, i got this error : "Run-time error '5992' Cannot access individual columns in this collection because the table has mixed cell widths"

Can anybody help, please
This comment was minimized by the moderator on the site
Bonjour,

Quand j'exécute le programme, l'erreur suivante s'affiche " Erreur de compilation : Instruction incorrecte à l'extérieur d'une procédure"

Quelqu'un a une solution s'il vous plait ?
This comment was minimized by the moderator on the site
I found this macro and it works great when it comes to a table with single empty rows.
Is it possible to change it to work on a table with split rows as well?
I would very much thank you if you have a solution for me.
This comment was minimized by the moderator on the site
Hi, shimon, I don't not understand your question, please give me examples or describe the question with more details.
This comment was minimized by the moderator on the site
You just saved me a zillion hours of frustration, THANK YOU!
This comment was minimized by the moderator on the site
u know you can just resize the table right? just filter and sort your data to top check how many rows have data, click table tools and the click resize and adjust the last number to whatever you need OR go to the bottom of the table the very last cell and use the tine blue triangle to drag and resize,
This comment was minimized by the moderator on the site
Except I have multiple page document with a table with varying information in each. Furthermore, it is a merge document so different each week. I need an automated method :)
This comment was minimized by the moderator on the site
Hi, the macro is working, BUT:

After deleting all rows, all the columns of the tables with empty rows open up very wide.

How can i fix the code so that this does not happens?


I am using Office 2016.


Thank you!
This comment was minimized by the moderator on the site
Hi All, I am looking for function in word wherein, if I remove specific word then it should remove that row as well.
This comment was minimized by the moderator on the site
Thanks for the code, really useful.
This comment was minimized by the moderator on the site
Is there a macro that will delete a row if only one of the cells in that row is empty or contains a zero?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations