Excel 中如何根据单元格内容删除行

根据单元格内容快速删除行,首先需要选中含有该单元格内容的所有行,然后删除。似乎在 Excel 当中除了 VBA 以外没有其他更快捷的方法能解决这个问题了。这里将推荐几个快速根据单元格内容删除行的方法给你。

通过查找和替换删除含有特定单元格内容的行

通过 VBA 代码删除含有特定单元格内容的行

用 Kutools for Excel 删除含有特定单元格内容的行

 

通过查找和替换删除含有特定单元格内容的行

在 Excel 当中,查找和替换功能是非常强大有用的,它也可以用来根据某个特定值删除行。

1. 按住 Ctrl + F 打开查找和替换对话框,然后在查找内容文本框里输入苹果(苹果就是你想要删除的行所依据的值)。如图所示:

zh cn excel remove rows based on cell value 1

2. 点击查找全部, 然后按 Ctrl + A 选中所有找到的结果。如图所示:

zh cn excel remove rows based on cell value 2

3. 点击关闭,你就会看到所有含有苹果的单元格都被选中了。右键点击打开右键菜单,选择删除。 如图所示:

zh cn excel remove rows based on cell value 3

4. 在删除对话框当中,选择整行

zh cn excel remove rows based on cell value 4


arrow blue right bubble 通过 VBA 代码删除含有特定单元格内容的行

用 VBA 代码快速删除包含特定值的行,可以按照以下步骤来实现:

Kutools for Excel囊括了120多種快速提升您 Excel 使用效率的工具。 60天內免費试用。

  免费下载Kutools for Excel                                 购买 Kutools for Excel

1. 选中想要删除行的区域。

2. 按住 Alt+ F11 打开 Microsoft Visual Basic for applications 窗口,然后点击插入 >> 模块,将下面代码复制粘贴到模块窗口当中。

VBA 代码: 根据指定单元格内容删除行

Sub DeleteRows()
'Updateby20140314
Dim rng As Range
Dim InputRng As Range
Dim DeleteRng As Range
Dim DeleteStr As String
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
DeleteStr = Application.InputBox("Delete Text", xTitleId, Type:=2)
For Each rng In InputRng
    If rng.Value = DeleteStr Then
        If DeleteRng Is Nothing Then
            Set DeleteRng = rng
        Else
            Set DeleteRng = Application.Union(DeleteRng, rng)
        End If
    End If
Next
DeleteRng.EntireRow.Delete
End Sub

3. 点击 F5 运行代码,在弹出的窗口中选择需要应用代码的区域。

zh cn excel remove rows based on cell value 5

4. 点击确定,会弹出另外一个窗口让你选择所依据的单元格,如图所示:

zh cn excel remove rows based on cell value 6

5. 点击确定,含有苹果的行就被删除了。

zh cn excel remove rows based on cell value 7zh cn arrowzh cn excel remove rows based on cell value 8

但是对于 Excel 初学者而言,通过 VBA 代码就有点复杂。所以接下来介绍一个更简单易懂的方法来依据单元格值删除行。


arrow blue right bubble 用 Kutools For Excel 删除含有特定单元格内容的行

如果你已经安装了 Kutools for Excel,通过它的选择指定单元格功能可快速地根据某个特定值删除行。

Kutools for Excel囊括了120多种快速提升您 Excel 使用效率的工具。60天內免费试用。

 免费下载Kutools for Excel                                 购买 Kutools for Excel

1. 选中需要根据单元格内容删除行的区域。

2. 点击 Kutools >> 选择 >> 选择指定单元格。如图所示:

doc select specific cell

3. 在选择指定单元格对话框当中,在选择类型中选择整行,然后在指定类型区域选择等于,并在旁边的文本框当中输入你想要依据的值(苹果)。 如图所示:

zh cn excel remove rows based on cell value 10

4. 点击确定或者应用,所有单元格值为苹果所在的行都被选中了。

注意:点击确定以后会弹出一个对话框告诉你有多少行被选中了。

5. 右键点击选中的行,在右键菜单中点击删除,所有含有苹果这一指定单元格内容的行将被删除。

zh cn excel remove rows based on cell value 11

点击这里了解更多关于选择指定单元格的内容。

点击这里免费下载Kutools for Excel


 


Is Your Problem Solved?

Yes, I want to be more efficiency and save time when using Excel          No, the problem persists and I need further support

Recommended Productivity Tools

The following tools will greatly save your time and effort, which one do you prefer?
Office TabUsing handy tabs in your Office, as the way of Chrome, Firefox and New Internet Explorer.
Kutools for Excel: 120 powerful new functions for Excel, Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for OfficeBring back familiar menus to Office 2007, 2010, 2013, 2016, 2019 and 365, as if it were Office 2000 and 2003.


Kutools For Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 More than 200 powerful advanced functions which designed for Excel:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

  • 4
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值