跳到主要內容

如何在Excel中快速插入空白/空行?

我們大多數人可能會遇到Excel中的問題,我們需要在每個現有行之間插入空白行,並且我們所有人都知道如何手動插入空白行。 但是,如果您分別插入每一行,那麼插入數百行空白行將是一項繁瑣的任務。 這裡有一些快速技巧可以幫助您解決此問題。

使用排序功能插入空白行
使用VBA代碼插入備用空白行
使用Kutools for Excel快速插入特定數量的空白行


使用排序功能插入空白行

此方法比較容易,但是可以在出口行之間插入空白行。 您可以執行以下操作:

1.您需要在數據旁邊添加一個空白列。 例如,我有一個包含A1:E9的工作表,可以使用F列。

2.在單元格F1中輸入數字1,並在單元格F2中輸入2。

3.選擇數字1和2,然後雙擊填充手柄,Excel將自動填充F列中的單元格。

4.然後復制此新列F(F1:F9),選擇單元格F10,然後粘貼F1:F9中的自動填充編號。 看截圖:

5.然後單擊 數據 > 分類 排序警告 彈出對話框,選擇 擴大選擇 選項,然後單擊 分類…看截圖:

6.還有一個 分類 出現對話框,選擇數字 1 來自 排序 下拉列表,然後單擊 OK 按鈕。 看截圖:

然後,新的空白行已插入到現有行中。 看截圖:

備註:如果要在每行之間插入兩到三行空白行,則可以復制新的自動填充列兩到三遍,以添加新行。

快速將特定數量的空白行插入Excel中的範圍:

插入空白行和列 的效用 Excel的Kutools 可以幫助您快速將一定數量的空白行或列插入Excel中的範圍。
立即下載 Kutools for Excel! (30 天免費試用)


使用VBA代碼插入備用空白行

如果上述方法有些複雜,則可以使用以下VBA代碼解決它。

1.按Alt + F11鍵打開 適用於應用程序的Microsoft Visual Basic 窗口,然後單擊 插入 > 模塊 並將以下代碼輸入到 模塊:

VBA代碼:在Excel中插入空白行

Sub InsertBlackRows()
'Updateby20131127
Dim Rng As Range
Dim WorkRng As Range
Dim FirstRow As Integer, xRows As Integer, xCols As Integer
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
FirstRow = WorkRng.Row
xRows = WorkRng.Rows.Count
xCols = WorkRng.Columns.Count
Application.ScreenUpdating = False
WorkRng.Cells(xRows, 1).Resize(1, xCols).Select
Do Until Selection.Row = FirstRow
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Offset(-1, 0).Select
Loop
Application.ScreenUpdating = True
End Sub

2。 然後點擊 文檔乘法計算 3 按鈕或按F5鍵運行代碼。 在彈出的Kutoos for Excel對話框中,請選擇要插入空白行的範圍,然後單擊“確定”按鈕。 看截圖:

然後在每兩行之間插入一個新的空白行。 看截圖:


使用Kutools for Excel快速插入特定數量的空白行

以上兩種方法僅是在每行之間插入空白行,即每第n行之後插入空白行或多行,該怎麼辦? 在這裡我推薦 插入空白行和列 的效用 Excel的Kutools。 此實用程序可以幫助將第n行之後的特定數量的空白行快速插入到一定範圍內。 請執行以下操作。

申請前 Excel的Kutools首先下載並安裝.

1.選擇要插入空白行的範圍,然後單擊 庫工具 > 插入 > 插入空白行和列。 看截圖:

2。 在裡面 插入空白行和列 對話框中選擇 空白行 在插入類型中 部分,指定要插入的空白行的間隔行數和要插入的行數,然後單擊 OK 按鈕。 看截圖:

然後,您可以看到每兩行之後插入了某些空白行。 查看屏幕截圖:

備註:中的數字 間隔 可以進行調整以滿足您的需求。 例如,您可以在每一,兩,三…行之後插入三,四,五…空白行。

  如果您想免費試用(30天)此實用程序, 請點擊下載,然後按照上述步驟進行操作。


使用Kutools for Excel快速插入特定數量的空白行


相關文章

最佳辦公生產力工具

🤖 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 (43)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thanks so much for this. Cheers.
This comment was minimized by the moderator on the site
So I'm running into a situation where a have a couple hundred rows of information. Id like to create a space between specific data. example. I have six rows with "CH-01" in it and then two rows with CH-02- and then three rows of CH-03. What I want to happen is create a blank row between the change of numbers. However I don't have the time or energy to do this for each individual change. Please if anyone has a solution for this problem i'd be so happy!
This comment was minimized by the moderator on the site
I have the same problem too, have you figured out how to solve this?
This comment was minimized by the moderator on the site
wonderful! it worked
This comment was minimized by the moderator on the site
thankssssss a lot you are an awesome people.
This comment was minimized by the moderator on the site
Thaaannkksss its work like magic
This comment was minimized by the moderator on the site
The sort method worked like a charm. Thanks for saving me time coding
This comment was minimized by the moderator on the site
i'm not religious or anything, but you are god. ;-)
This comment was minimized by the moderator on the site
The sort option worked, sometimes we learn all advanced and tuff things but we tend to forget the simple ones.. Thanks a lot
This comment was minimized by the moderator on the site
Can the VBA code be changed so that you do not need to select the range you want sorted, but instead is a specific range. For example I always want the range to be (S5:S500) I would like to run this code as part of a macro and do to the selection application this isn't working. This code works faster by far than other code ive tried.
This comment was minimized by the moderator on the site
very good its superb
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