跳到主要内容

如何在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中的范围:

插入空白行和列 实用程序 Kutools for Excel 可以帮助您快速将一定数量的空白行或列插入Excel中的范围。
立即下载 Excel 版 Kutools! (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行之后插入空白行或多行,该怎么办? 在这里我推荐 插入空白行和列 实用程序 Kutools for Excel。 此实用程序可以帮助将第n行之后的特定数量的空白行快速插入到一定范围内。 请执行以下操作。

申请前 Kutools for Excel首先下载并安装.

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 Tab 为 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