如果在Excel中進行過濾,如何突出顯示列或列標題?
對於具有多列的表,一目了然地找出要過濾的列是不容易的,因為除了 標記。 如果要使表中未過濾的列突出顯示,本文中的方法可以為您提供幫助。
突出顯示列標題或整個列(如果已使用VBA代碼過濾)
如下面的屏幕截圖所示,如果在表範圍內過濾了此列,則需要突出顯示整個列或僅突出顯示列標題,請應用以下VBA代碼。
1。 按 其他 + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。
2.在“ Microsoft Visual Basic for Applications”窗口中,請單擊 插入 > 模塊。 然後將下面的VBA代碼複製到“模塊”窗口中。
VBA代碼:如果已過濾列,則突出顯示列標題
Sub HighLightTitle()
'Updated by Extendoffice 2017/9/12
Dim xRg As Range
Dim I As Integer
Dim xCount As Long
Dim xRgCol As Long
Dim xAddress As String
Dim xFilterCount As Long
On Error Resume Next
xAddress = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Please select the first cell of the table range:", "KuTools For Excel", xAddress, , , , , 8)
If xRg Is Nothing Then Exit Sub
xRg.Select
With xRg(1).Parent.AutoFilter
xFilterCount = .Range.Columns.Count
xRgCol = xRg.Offset(1).Column - .Range.Column + 1
For I = xRgCol To xFilterCount
xCount = xRg.Offset(, I - xRgCol).Column - .Range.Column + 1
With .Filters(xCount)
If .On Then
xRg.Offset(, I - xRgCol).Interior.Color = 16736553
End If
End With
Next
End With
End Sub
如果要突出顯示整列(如果已在表格中進行過濾),請複制以下VBA代碼並將其粘貼到“模塊”窗口中。
VBA代碼:突出顯示整列(如果已過濾)
Sub HighLightCols()
'Updated by Extendoffice 2017/9/12
Dim xRg As Range
Dim xCount As Long
Dim xRgCol As Long
Dim xAddress As String
Dim xRgFilter As Range
Dim xFilterCount As Long
On Error Resume Next
xAddress = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Please select the first cell of the table range:", "KuTools For Excel", xAddress, , , , , 8)
If xRg Is Nothing Then Exit Sub
xRg.Select
With xRg(1).Parent.AutoFilter
xFilterCount = .Range.Columns.Count
xRgCol = xRg(1).Column - .Range.Column + 1
For I = xRgCol To xFilterCount
xCount = xRg.Offset(, I - xRgCol).Column - .Range.Column + 1
With .Filters(xCount)
Set xRgFilter = xRg.Offset(, I - xRgCol).Parent.AutoFilter.Range.Columns(xCount)
If .On Then
xRgFilter.Interior.Color = 16736553
End If
End With
Next
End With
End Sub
3。 按 F5 鍵來運行代碼。 在彈出 Kutools for Excel 對話框,請選擇您需要突出顯示已過濾列標題或整個已過濾列的表格的第一個單元格,然後單擊 OK 按鈕。
然後,如果在特定表中過濾了該列,則該列標題或整個列將立即突出顯示。 查看屏幕截圖:
如果表中過濾了列,則突出顯示列標題:
突出顯示整列(如果在表格中進行了過濾):
最佳辦公生產力工具
熱門特色: 尋找、突出顯示或識別重複項 | 刪除空白行 | 合併列或儲存格而不遺失數據 | 沒有公式的回合 ... | |
超級查詢: 多條件VLookup | 多值VLookup | 跨多個工作表的 VLookup | 模糊查詢 .... | |
高級下拉列表: 快速建立下拉列表 | 依賴下拉列表 | 多選下拉列表 .... | |
欄目經理: 新增特定數量的列 | 移動列 | 切換隱藏列的可見性狀態 | 比較範圍和列 ... | |
特色功能: 網格焦點 | 設計圖 | 大方程式酒吧 | 工作簿和工作表管理器 | 資源庫 (自動文字) | 日期選擇器 | 合併工作表 | 加密/解密單元格 | 按清單發送電子郵件 | 超級濾鏡 | 特殊過濾器 (過濾粗體/斜體/刪除線...)... | |
前 15 個工具集: 12 文本 工具 (添加文本, 刪除字符,...) | 50+ 圖表 類型 (甘特圖,...) | 40+ 實用 公式 (根據生日計算年齡,...) | 19 插入 工具 (插入二維碼, 從路徑插入圖片,...) | 12 轉化 工具 (數字到單詞, 貨幣兌換,...) | 7 合併與拆分 工具 (高級合併行, 分裂細胞,...) | ... 和更多 |
增強您的 Excel 技能 Kutools for Excel,體驗前所未有的效率。 Kutools for Excel 提供 300 多種高級功能,可提高工作效率並節省時間。 點擊此處獲取您最需要的功能...
Office Tab 為 Office 帶來選項卡式界面,讓您的工作更輕鬆
- 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
- 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
- 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!

Sort comments by

#32503
This comment was minimized by the moderator on the site
0
0

#27830
This comment was minimized by the moderator on the site
0
0

#27833
This comment was minimized by the moderator on the site
0
0

#27831
This comment was minimized by the moderator on the site
Report
0
0

#27832
This comment was minimized by the moderator on the site
0
0
There are no comments posted here yet