跳到主要內容

如何在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中單擊幾下即可快速過濾列中的粗體單元格:

過濾粗體細胞 的效用 Excel的Kutools 可以幫助您通過單擊幾下來快速過濾某個列中的所有粗體單元,如下所示。
立即下載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 運行此宏的鍵。 然後,將立即在選定的列範圍內過濾掉所有粗體單元格。


使用出色的工具輕鬆過濾粗體細胞

在本節中,我們建議您使用方便的工具- 過濾粗體細胞 的效用 Excel的Kutools。 使用此實用程序,單擊幾下即可立即過濾選定列中的所有粗體單元格。

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

1.選擇要過濾粗體單元格的列範圍,單擊 Kutools 加> 特殊過濾器 > 過濾粗體 完成它。 參見下面的演示:

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


相關文章

在Excel中同時過濾多個列
使用“過濾器”功能過濾一列後,只能將“與”條件應用於多於一列。 在這種情況下,如何在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選項卡為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