跳到主要内容

如何在Excel中通过粗体字符过滤单元格?

您可以应用粗体字体样式来设置Excel中单元格中的数据或内容的格式,但是您知道如何通过Excel中包含粗体字体的单元格来过滤单元格吗? 本文收集了一些棘手的VBA宏,以在Excel中用粗体字符过滤单元格。

使用助手列过滤粗体单元格
使用VBA代码过滤粗体单元格
使用出色的工具轻松过滤粗体细胞
有关数据过滤的更多教程…


使用帮助列过滤粗体单元格

假设您需要过滤B列中的所有粗体单元格,如下图所示,请执行以下操作:

下面的用户定义函数有助于识别列中的单元格是否为粗体,然后在帮助器列中将结果返回为TRUE或False。 您可以过滤所有TRUE结果,以仅在B列中显示粗体单元格。

1。 按 其他 + F11 键打开 Microsoft Visual Basic应用程序 窗口。

2.在 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 模块 然后将以下VBA代码复制到“模块”窗口中。 看截图:

VBA代码:用粗体字符过滤单元格

Function IsBold(rCell As Range)
IsBold = rCell.Font.Bold
End Function

3。 按 其他 + Q 键关闭代码窗口。

4.选择一个与表格相邻的空白单元格(所选单元格应位于过滤器表格第一行的同一行上),将以下公式复制到其中,然后按 进入 键。

= IsBold(B2)

5.继续选择第一个结果单元格,然后拖动“填充手柄”以获取所有结果。 看截图:

6.选择帮助器列的标题,单击 时间 > 过滤。 点击标题单元格旁边的箭头按钮,检查 TRUE 框,然后单击 确定。

现在,B列中的所有粗体单元格都被过滤掉,如下图所示。


在Excel中单击几下即可快速过滤列中的粗体单元格:

过滤粗体细胞 实用程序 Kutools for Excel 可以帮助您通过单击几下来快速过滤某个列中的所有粗体单元,如下所示。
立即下载 Kutools for Excel 的全功能 30 天免费试用版!


使用VBA代码过滤粗体单元格

下面的VBA代码可让您直接过滤一列中的所有粗体单元格。 请执行以下操作。

1.选择列范围,您将滤除标题单元格以外的所有粗体单元格。 在这种情况下,我选择B2:B16。

2。 按 其他 + F11 键打开 Microsoft Visual Basic应用程序 窗口。

3.在 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 模块 然后将以下VBA代码复制并粘贴到“模块”窗口中。

VBA代码:过滤列中的粗体单元格

Sub FilterBold()
'Updated by Extendoffice 20191018
Dim cell As Range
For Each cell In Selection
If cell.Font.Bold = False Then
cell.EntireRow.Hidden = True
End If
Next cell
End Sub

4。 按 F5 运行此宏的键。 然后,将立即在选定的列范围内过滤掉所有粗体单元格。


使用出色的工具轻松过滤粗体细胞

在本节中,我们建议您使用方便的工具- 过滤粗体细胞 实用程序 Kutools for Excel。 使用此实用程序,单击几下即可立即过滤选定列中的所有粗体单元格。

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

1.选择要过滤粗体单元格的列范围,单击 Kutools 加> 特殊过滤器 > 过滤粗体 完成它。 参见下面的演示:

  如果您想免费试用(30天)此实用程序, 请点击下载,然后按照上述步骤进行操作。


相关文章

在Excel中同时过滤多个列
在使用“过滤器”功能过滤一列后,只能将AND条件应用于多个列。 在这种情况下,如何在Excel工作表中同时应用AND和OR条件来同时过滤多个列? 本文中的方法可以帮您一个忙。

在Excel中按单元格颜色过滤或选择单元格
通常,您可以出于任何目的在Excel中用不同的颜色填充单元格。 如果您有一个工作表使用不同的颜色来表示不同的内容类型,并且想要按单元格颜色过滤或选择这些单元格,则可以使用本文中的方法来完成。

粘贴跳过Excel中隐藏/过滤的单元格和行
例如,您已经在Excel中过滤了一个表格,但是现在您需要复制一个范围并将其粘贴到此过滤的表格中,您知道如何跳过跳过隐藏/过滤的单元格和行吗? 本文中的几种简单方法可以为您提供帮助。

根据另一个工作表中的列表选择过滤行
在Excel中,我们通常根据条件过滤行,但是如果有两个列表,一个在Sheet1中,另一个在Sheet2中,您是否有任何技巧可以根据Sheet1中的列表快速过滤Sheet2中的行? 本文在此介绍解决此工作的方法。

从Excel中的合并单元格过滤所有相关数据
假设您的数据范围中有一列合并的单元格,现在,您需要使用合并的单元格来过滤此列,以显示与每个合并的单元格相关的所有行,如以下屏幕截图所示。 在excel中,“筛选器”功能允许您仅筛选与合并单元格关联的第一项,在本文中,我们正在讨论如何从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 (16)
Rated 4.5 out of 5 · 2 ratings
This comment was minimized by the moderator on the site
Thanks for sharing, it works wonderful, thank you!
Rated 4.5 out of 5
This comment was minimized by the moderator on the site
Thanks for the formula..it helped
Rated 4.5 out of 5
This comment was minimized by the moderator on the site
I've used this technique and had an issue when trying to copy the bold data. It only copies some of the data for some reason. Is there any way of copying only the bold data using this technique? Thanks, Richard
This comment was minimized by the moderator on the site
Dear richard skins,



We didn't encounter the problem as you mentioned. Would you please provide a screenshot with details of your operation?



Thank you for your comment!
This comment was minimized by the moderator on the site
Hi, I'm a complete excel novice, i've done the following technique but now need to copy the data which is bold/true. When I have tried to do this is won't copy what is highlighted. Any ideas on how I can copy the data? Thanks, Richard
This comment was minimized by the moderator on the site
@RICHARD Can u please provide any screenshot of your spreadsheet showing what u are exactly trying to do?
This comment was minimized by the moderator on the site
Thanks for sharing. It works wonderful.
This comment was minimized by the moderator on the site
Hi I am using this code and its working fine but whenever I click on cancel the dialogue box a popup window appear and shows some error. Can you please tell me how to remove that error. :Sub FilterBold() Dim myRange As Range Set myRange = Application.InputBox(Prompt:="Please Select a Range", Title:="InputBox Method", Type:=8) myRange.Select Application.ScreenUpdating = False For Each myRange In Selection If myRange.Font.Bold = False Then myRange.EntireRow.Hidden = True End If Next myRange Application.ScreenUpdating = True End Sub
This comment was minimized by the moderator on the site
Dear Nitin Jain,

Sorry to reply so late!

We have found the proble and fixed it already. The VBA script in the article is now updated,

Thank you for your comment!
This comment was minimized by the moderator on the site
Simple and brilliant, thank you!
This comment was minimized by the moderator on the site
This worked perfectly, thank you!!! :D :lol:
This comment was minimized by the moderator on the site
I presume that column A is the reference Column with Bold cells. I create a Name "Bold?" with the refer to as below =GET.CELL(20,OFFSET(INDIRECT("A1"),ROW()-1,0)) In column B, I type: =Bold? Copy down the formula and then use autofilter to filter the value TRUE. DONE
This comment was minimized by the moderator on the site
@cadafi ur formula works fine but it is not the optimised or efficient use of it. Rather we should use direct reference of the range or a cell in place of that complete offset command. Like the one as follows: =GET.CELL(20,'Sheet1'!A1) Copy down the formula and then use autofilter to filter the value TRUE. DONE
This comment was minimized by the moderator on the site
Thanks Mohamand Faizan. You are entirely correct.
This comment was minimized by the moderator on the site
@Mohammad Faizan You are entirely correct. Thanks.
This comment was minimized by the moderator on the site
@Cadafi.... thats brilliant... wondering how it works though!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations