跳到主要内容

如何快速删除Excel中的其他所有行?

如果要快速删除Excel中的所有其他行或列,重点是如何首先快速选择其他所有行或列,然后对它们应用删除操作。 本文将向您展示一些棘手的事情,有关如何首先选择每隔一行或每一列然后快速删除它们。

使用筛选器命令删除Excel中的所有其他行

使用VBA代码删除Excel中的所有其他行

使用 Kutools for Excel 删除 Excel 中的每隔一行或一列


箭头蓝色右气泡 使用筛选器命令删除Excel中的所有其他行

Microsoft Excel的 筛选器 命令可以帮助您快速过滤其他所有行,然后立即将其删除,请执行以下操作:

1。 在原始数据之外的空白列中,输入 0,1,0,1…,0,1。 在这种情况下,我们在助手C列中输入数字。请参见以下屏幕截图:

2。 选择列C,然后单击 筛选器 按钮下 时间 标签。 然后点击C1旁边的箭头按钮,然后仅检查 0 在下面 选择全部 选项。 看截图:

3。 然后所有带有1的行都被隐藏。 用0选择可见的行,然后单击 主页 > 删除 > 删除工作表行 删除这些行。 然后删除所有其他行,您需要单击 筛选器 再次单击按钮仅显示带有1的行。请参见屏幕截图:

删除所有其他行doc -2 删除所有其他行doc

4。 最后,您可以根据需要删除帮助程序列C。


选择每隔一行或第n行,每列,然后立即将其删除

Kutools for Excel's 选择间隔行和列 实用程序可以帮助您查找和选择每隔一行或第n行或第n行,然后可以根据需要执行一些操作。 点击下载Kutools for Excel!


箭头蓝色右气泡 使用VBA代码删除Excel中的所有其他行

实际上,VBA宏也是解决此问题的不错选择。

1. 按住 其他 + F11 键,然后打开 Microsoft Visual Basic应用程序 窗口。

2。 请点击 插页 > 模块,然后将以下宏粘贴到 模块 窗口。

VBA代码:删除所选内容中的所有其他行:

Sub DeleteEveryOtherRow()
'Updateby Extendoffice
Dim rng As Range
Dim InputRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Application.ScreenUpdating = False
For i = InputRng.Rows.Count To 1 Step -2
    Set rng = InputRng.Cells(i, 1)
    rng.EntireRow.Delete
Next
Application.ScreenUpdating = True
End Sub

3.F5 运行此宏的键。 然后会弹出一个对话框,用于选择范围。 看截图:

4。 然后点击 OK,则会立即删除第二行中所选范围内的所有其他行,请参见屏幕截图:

删除所有其他行doc -2 删除所有其他行doc

箭头蓝色右气泡 使用 Kutools for Excel 删除 Excel 中的每隔一行或一列

对于Microsoft Excel的初学者来说,使用VBA宏有点复杂。 的 选择间隔行和列 实用程序 Kutools for Excel 可以帮助您快速删除其他所有行。

Kutools for Excel : 带有300多个便捷的Excel加载项,可以在30天内免费试用. 

安装后 Kutools for Excel,请执行以下操作:

1。 选择要删除的所有其他行的范围,然后通过单击 库工具 > 选择 > 选择间隔行和列….

2。 在 选择间隔行和列 对话框中,如下图所示指定设置,然后单击 OK 按钮以首先选择其他每行。

3。 然后,选择中的每隔一行被选中并突出显示。 看截图:

4。 然后,您可以通过单击 主页 > 删除 > 删除工作表行 删除所有这些行。 查看屏幕截图:

删除所有其他行doc -2 删除所有其他行doc

单击以了解有关此“选择间隔行和列”功能的更多信息。

使用此功能,您还可以根据需要删除第n行或每列。

立即下载并免费试用 Kutools for Excel!


箭头蓝色右气泡演示:使用 Kutools for Excel 删除每隔一行或每一列

Kutools for Excel:具有300多个方便的Excel加载项,可以在30天内免费试用,没有任何限制。 立即下载并免费试用!

最佳办公生产力工具

🤖 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 (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
An easy way to put 0 or 1 in the column instead is to add a formula column: =IF(MOD(ROW(), 2) = 0, 0, 1). That might help if you'd rather not type 0,1,01, etc.
This comment was minimized by the moderator on the site
another way is to add a new column in front of your data, so column A is blank, then just enter a b a b a b as you go down the rows in column A - so "a" in A1, "b" in A2, "a" in A3, "b" in A4. then you can drag the new "a" and "b" cells down for all rows of data. then sort column A alphabetically, and you get all the odd rows with an "a" at the top and all the even rows with a "b" at the bottom. this is probably the easiest way.
This comment was minimized by the moderator on the site
You're genious :)
This comment was minimized by the moderator on the site
Easiest? How is that different from the 0,1 method? ;-)
This comment was minimized by the moderator on the site
This is actually very useful if you have a large number of rows and can't enter the 2 settings in manually. if you drag 0,1 down, it continues to 2, 3, 4...but if you drag a,b down, it will repeat as a,b,a,b...all the way down. Thanks!
This comment was minimized by the moderator on the site
That would be great, except column C is all 0
This comment was minimized by the moderator on the site
This is really really helpful. thanks
This comment was minimized by the moderator on the site
Great trick...thank you. I love simple sneaky tricks like this
This comment was minimized by the moderator on the site
This was really helpful. thanks,
This comment was minimized by the moderator on the site
In cell B1: =row(A1) Drag this down all of column B. In cell C1: =mod(B1,2) Drag this down all of column C. Apply a filter and in column C select all 0s or 1s as required.
This comment was minimized by the moderator on the site
Richarddddd, Sneaky! I like that, and it was useful to me today. Thanks.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations