跳到主要內容

4種快速刪除Excel中多個空白或空行的簡單方法

如果整個工作表或工作簿中需要刪除數百行空白行,您將感到沮喪。 在這裡,本教程將逐步列出一些快速的方法來為您逐步完成此工作。


方法A:使用轉到特殊命令刪除空白行

現在,請按照以下步驟操作,使用“轉到特殊行”刪除空行:

1.選擇要刪除空白行的範圍,單擊 首頁 標籤,然後在 編輯 組,單擊 查找和選擇 > 去特別.
doc刪除空白行2

2。 在裡面 去特別 對話框,檢查 空白 選項。
doc刪除空白行3

3。 點擊 OK,現在已選擇了選擇中的所有空白單元格。
doc刪除空白行4

4。 點擊 首頁 標籤,在 細胞 組,單擊 刪除 > 刪除工作表行.
doc刪除空白行5

現在帶有空白單元格的行已被刪除。
doc刪除空白行6

注意:

使用“轉到特殊位置”命令刪除空白行時有致命流程:
所有行均包含空白單元格(即使該行包含一個空白單元格,而其他列包含數據)也將被刪除,如下圖所示。

doc刪除空白行1


您想加薪並有很多時間陪伴家人嗎?

Office選項卡可將Microsoft Office立即工作的效率提高50%

令人難以置信的是,處理兩個或多個文檔比處理一個或多個文檔更容易,更快捷。

與知名瀏覽器相比,Office Tab中的選項卡式工具功能更強大,更高效。

每天為您減少數百次鼠標單擊和鍵盤輸入,現在告別鼠標手。

如果您通常處理多個文檔,Office Tab將為您節省大量時間。

30天免費試用,無需信用卡。

閱讀更多立即下載


方法B:使用Kutools刪除範圍/工作表/工作簿中的空白行

如果要快速輕鬆地刪除選擇,活動工作表,所選工作表或整個工作簿中的所有空白行,而又沒有任何錯誤的刪除,則可以嘗試 刪除空白行 的工具 Excel的Kutools,無需VBA代碼和幫助程序列即可一鍵處理作業。

但是,在使用此工具之前,您需要 免費安裝Kutools for Excel 首先。

點擊 庫工具 > 刪除 > 刪除空白行,然後在子下拉列表中,根據需要選擇一項操作。
doc刪除空白行17

演示:一鍵刪除所有空白行


方法C:使用VBA代碼刪除空白行

1。 按 Alt + F11鍵 啟用鑰匙 Microsoft Visual Basic for Applications 窗口。

2。 點擊 插入 > 模塊 創造一個新的 模塊 腳本,將以下代碼複製並粘貼到腳本中。

VBA:刪除空行

Sub DeleteBlankRows()
'Update 20190107
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)
xRows = WorkRng.Rows.Count
Application.ScreenUpdating = False
For I = xRows To 1 Step -1
    If Application.WorksheetFunction.CountA(WorkRng.Rows(I)) = 0 Then
        WorkRng.Rows(I).EntireRow.Delete XlDeleteShiftDirection.xlShiftUp
    End If
Next
Application.ScreenUpdating = True
End Sub

doc刪除空白行7

3。 按 F5 鍵運行代碼,然後選擇一個用於刪除彈出窗口中空白行的範圍 Kutoolsfor Excel 對話。
doc刪除空白行8

4。 點擊 OK。 現在,選擇中的空行已刪除。
doc刪除空白行9

注意:

使用此VBA代碼,最好刪除某個範圍內的空白行,但不能刪除整個工作表中的空白行,否則Microsoft Excel可能會卡住。


方法D:使用幫助器列和過濾器功能刪除空白行

1.在數據范圍之前插入一列,以插入列A為例,然後鍵入此公式 = B3&C3&D3 到A3中以合併row3中的數據,請參見屏幕截圖:

尖端:如果您的數據跨越B3列到N列,請將公式調整為= B3&C3&D3&E3&…&N3。
doc刪除空白行10

2.然後通過向下拖動自動填充手柄將公式填充到單元格中。
doc刪除空白行11

3。 然後點擊 數據 > 篩選.
doc刪除空白行12

4。 然後點擊 篩選器圖標 在助手列中,檢查 空白 選項僅在下拉列表中。 看截圖:
doc刪除空白行13

5。 點擊 OK,所有空白行均已被過濾掉。
doc刪除空白行14

6.選擇過濾的行,單擊 首頁 > 刪除 > 刪除工作表行 刪除空白行。
doc刪除空白行15

7。 然後點擊 數據 > 篩選 再次禁用 篩選 的功能。
doc刪除空白行16

注意:

與方法A和方法C相比,此方法可以為每個Excel用戶準確刪除空白行並易於處理。 但是,如果您的數據中有數十列,則此方法將有些乏味。


相關操作:每隔一行插入空白行

也許有時候,您想在範圍的每隔一行中插入空白行,如下圖所示:
doc刪除空白行18

在這種情況下,您可以應用 插入空白行和列 Kutools for Excel實用程序可快速處理此工作。

1.選擇要在每隔一行中插入空白行或列的範圍,然後單擊 庫工具 > 插入 > 插入空白行和列.
doc刪除空白行19

2。 在裡面 插入空白行和列 對話框,檢查 空白行 or 空白欄 您需要的選項 插入類型 然後,在 選項 部分,指定 間隔/.
doc刪除空白行20

3。 點擊 Ok,空白行已插入到選擇的每隔一行中。

演示:插入空白行和列


下載樣本文件

樣品點擊下載示例文件

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (54)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
excelente me sirvio el punto uno para 40000 registros en 1 seg
This comment was minimized by the moderator on the site
Great!!! This helps a lot.
This comment was minimized by the moderator on the site
VERY NICE, THANKS
This comment was minimized by the moderator on the site
:lol: Good to share! Thank you!
This comment was minimized by the moderator on the site
Very Helpful :-) it helped me to reconcile big report.
This comment was minimized by the moderator on the site
Guys I recently had this issue. I realised that the F5 special blanks wouldn't work because some of my columns had merged data sharing some rows... I just selected the columns needed and make sure the merge button was unselected. From there, the F5 special blanks select worked! Hope it helps someone.
This comment was minimized by the moderator on the site
This is simple VBA code to delete the entire rows based on particular column:- Sub DeleletBlankrows() Range("A1:A10000").SpecialCells(xlCellTypeBlanks).EntireRow.Delete End Sub
This comment was minimized by the moderator on the site
only usefull if you want to delete ANY row with ONE blank cell, not delete rows with ALL cells being blank. Isn't this titled "How to remove blank or empty rows in Excel?" not "How to remove rows with blank cells?"
This comment was minimized by the moderator on the site
Ah, no, actually. The whole purpose of the sort & filter routine I demonstrated is to take out ONLY rows that are entirely blank across. The inquirer did not want any row removed that had some data in it... only rows that were completely blank. And the problem with the BLANK command was that it took out ANY rows entirely that had even one blank cell, erasing the rest of the data on the same row. Try it. It does the opposite of what you stated in your first sentence.... it takes out only entire blank rows, and leaves ALL the remaining data intact.
This comment was minimized by the moderator on the site
When you select multiple columns, then go to Find & Select -> Go To Special and choose blanks, it will highlight every blank cell within that range. If you then proceed to Delete -> Delete Sheet Rows, it will delete all rows that had a blank cell selected. Go try it.
This comment was minimized by the moderator on the site
oh bro thankyou very very much .....
This comment was minimized by the moderator on the site
thanks a lot, it saved lot of time
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