Przejdź do głównej zawartości

Jak usunąć puste wiersze i kolumny z tabel w programie Word?

Jak usunąć wszystkie puste wiersze i kolumny z tabel w programie Word? Ten samouczek pokaże Ci kilka sposobów usuwania pustych wierszy i kolumn z tabel w dokumencie programu Word.

Ręcznie usuń wszystkie puste wiersze i kolumny z tabel

Usuń wszystkie puste wiersze i kolumny z tabel przy użyciu kodu VBA

Usuń wszystkie puste wiersze i kolumny z tabel jednym kliknięciemdobry pomysł 3


Ręcznie usuń wszystkie puste wiersze i kolumny z tabel

Program Microsoft Office Word nie zapewnia wygodnego sposobu usuwania pustych wierszy i kolumn i musisz je usunąć, ręcznie zaznaczając każdy pusty wiersz i kolumnę, a następnie usuwając je jeden po drugim.

Krok 1: Wybierz pusty wiersz lub pustą kolumnę, którą chcesz usunąć. Zobacz zrzut ekranu:

dokument-removerowsandcols-1

Krok 3: poniżej Stół Narzędzia, kliknij układ Patka;

dokument-removerowsandcols-2

Krok 4: W Rzędy kolumny grupa, kliknij Usuń wiersze lub Usuń kolumny.

dokument-removerowsandcols-3


Usuń wszystkie puste wiersze i kolumny z tabel przy użyciu kodu VBA

Funkcja makra programu Word zapewnia znacznie wygodniejszy sposób usuwania wszystkich pustych wierszy i kolumn z tabel w dokumencie. Możesz usunąć wszystkie puste wiersze i kolumny w następujący sposób.

Krok 1: Naciśnij „Alt-F11” aby otworzyć okno Microsoft Visual Basic for Application;

Krok 2: Kliknij Moduł na wstawka tab, skopiuj i wklej następujący kod VBA do okna Module;

Krok 3: Następnie kliknij rundokument-odwrotny-znak-6 przycisk, aby zastosować VBA.

Kod VBA do usuwania wszystkich pustych wierszy i kolumn z tabel:

Sub DeleteEmptyTablerowsandcolumns ()
Application.ScreenUpdating = Fałsz
Dim Tbl As Table, cel As Cell, i as Long, n as Long, fEmpty as Boolean
Dzięki ActiveDocument
Dla każdej tabeli w .Tables
n = Tbl.Kolumny.Liczba
Dla i = n Do 1 Krok -1
fPusty = Prawda
Dla każdej komórki w Tbl.Columns (i) .Cells
Jeśli Len (cel.Range.Text)> 2 Then
fPuste = Fałsz
Wyjdź dla
End If
Następna cel
Jeśli fEmpty = True Then Tbl.Columns (i) .Delete
Dalej i
Następny Tbl
Kończyć z
Dzięki ActiveDocument
Dla każdej tabeli w .Tables
n = Tbl.Wiersze.Liczba
Dla i = n Do 1 Krok -1
fPusty = Prawda
Dla każdej komórki w Tbl.Rows (i) .Cells
Jeśli Len (cel.Range.Text)> 2 Then
fPuste = Fałsz
Wyjdź dla
End If
Następna cel
Jeśli fEmpty = True To Tbl.Rows (i) .Delete
Dalej i
Następny Tbl
Kończyć z
Ustaw cel = Nic: Ustaw Tbl = Nic
Application.ScreenUpdating = True
End Sub


Usuń wszystkie puste wiersze i kolumny z tabel jednym kliknięciem

Kutools for Word zapewnia najwygodniejszy sposób usunięcia wszystkich pustych wierszy i kolumn z tabel w dokumencie. Wystarczy raz kliknąć i Kutools dla Worda's Delete Rows/Columns narzędzie szybko usunie wszystkie puste wiersze i kolumny ze wszystkich lub wybranych tabel.

Kutools dla Worda, ponad  przydatne funkcje, ułatwiają pracę. 

Po zainstalowaniu Kutools for Word, wykonaj poniższe czynności:(Bezpłatne pobieranie Kutools for Word teraz!)

1. kliknij Kutools Plus > Delete Rows/Columns na Table szkło.

doc usuwa puste wiersze kolumny z tabeli 1

2. Następnie pojawi się okno dialogowe, wybierz zakres, z którego chcesz usunąć tabele w sekcji Szukaj w, a następnie zaznacz Rząd opcja i Pusty wiersz opcja lub sprawdź Kolumna opcja i Pusty wiersz opcja, jak potrzebujesz. Jeśli chcesz usunąć wszystkie puste wiersze i kolumny, musisz dwukrotnie zastosować tę operację.

doc kutools usuwa puste wiersze 2  doc kutools usuwa puste wiersze 3 

Teraz wyskakuje okno dialogowe przypominające o liczbie obsłużonych tabel, kliknij OK aby zamknąć, a puste wiersze i kolumny zostały usunięte z tabel.
doc kutools usuwa puste wiersze 4

Wskazówka.Jeśli chcesz usunąć puste wiersze z arkusza programu Excel, rozszerzenie Usuń puste wiersze narzędzie Kutools for Excel może ci pomóc.

Najlepsze narzędzia biurowe

Kutools dla Worda - Podnieś swoje doświadczenie ze słowami dzięki Over 100 Niezwykłe funkcje!

🤖 Kutools Asystent AI: Zmień swoje pisanie dzięki AI - Generuj zawartość  /  Przepisz tekst  /  Podsumowanie dokumentów  /  Zapytaj o informacje na podstawie Dokumentu, wszystko w programie Word

📘 Znajomość dokumentów: Podziel strony  /  Scal dokumenty  /  Eksportuj zaznaczenie w różnych formatach (PDF/TXT/DOC/HTML...)  /  Wsadowa konwersja do formatu PDF  /  Eksportuj strony jako obrazy  /  Drukuj wiele plików jednocześnie...

Edycja treści: Znajdź i zamień partii w wielu plikach  /  Zmień rozmiar wszystkich zdjęć  /  Transponuj wiersze i kolumny tabeli  /  Konwertuj tabelę na tekst...

🧹 Łatwe czyszczenie: Wymień Dodatkowe przestrzenie  /  Podziały sekcji  /  Wszystkie nagłówki  /  Pola tekstowe  /  Hiperłącza  / Więcej narzędzi do usuwania znajdziesz na naszej stronie Usuń grupę...

Kreatywne wstawki: Wstawić Tysiące separatorów  /  Pola wyboru  /  Przyciski Radio  /  Kod QR  /  kod kreskowy  /  Tabela linii ukośnych  /  Podpis równania  /  Tytuł Zdjęcia  /  Podpis tabeli  /  Wiele zdjęć  / Odkryj więcej w Wstaw grupę...

🔍 Precyzyjne wybory: Punktowy konkretne strony  /  stoły  /  kształty  /  nagłówki akapitów  / Ulepsz nawigację za pomocą jeszcze Wybierz funkcje...

Ulepszenia gwiazd: Nawiguj szybko do dowolnej lokalizacji  /  automatyczne wstawianie powtarzającego się tekstu  /  płynnie przełączaj się pomiędzy oknami dokumentów  /  11 Narzędzia konwersji...

???? Chcesz wypróbować te funkcje? Kutools dla Word oferuje Bezpłatna wersja próbna 60-day, bez ograniczeń! 🚀
 
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