メインコンテンツへスキップ

Excelでフィルタリングされている場合、列または列ヘッダーを強調表示するにはどうすればよいですか?

複数の列を持つテーブルの場合、フィルタリングされた列の明確な記号がないため、どの列がフィルタリングされているかを一目で確認するのは簡単ではありません。 マーク。 フィルター処理された列をテーブル内で目立たせたい場合は、この記事のメソッドが役立ちます。

VBAコードでフィルタリングされている場合は、列ヘッダーまたは列全体を強調表示します


VBAコードでフィルタリングされている場合は、列ヘッダーまたは列全体を強調表示します

以下のスクリーンショットに示すように、列全体を強調表示するか、この列がテーブル範囲でフィルタリングされている場合は列ヘッダーのみを強調表示する必要があります。次のVBAコードを適用してください。

1。 プレス 他の + F11 キーを押して アプリケーション向け Microsoft Visual Basic 窓。

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

次に、列が特定のテーブルでフィルタリングされている場合、列ヘッダーまたは列全体がすぐに強調表示されます。 スクリーンショットを参照してください:

列がテーブルでフィルタリングされている場合は、列ヘッダーを強調表示します。

テーブルでフィルタリングされている場合は、列全体を強調表示します。

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
solution that can help create updated vba is TO add additional duplicate first raw in row A1, Row A2 should be the beginning of the filtered data ( exact duplicate of all data in Row A1 - Row A1 and A2 should me same ), so we always have one header line without filter drop down icon and with OG format, once the macro is ran with few columns filtered it will highlight the filtered column as usual and after removing the desired columns filter or all columns filter it should copy the format in A1 Column, for the columns with no filtered sorting can this be done ?
This comment was minimized by the moderator on the site
this would be fantastic for me, but I couldn't make it work. I used the code to color the whole column. when I filtered the first time, the column turned blue. however when I cleared the filter, the blue remained. Afterwards, filtering another column had no effect. so at the moment I am left with one blue column. using latest Excel of Office 365.
This comment was minimized by the moderator on the site
I had the same issue. Once the column is unfiltered. The column remained blue. Also, when do you filter a new column, it's unchanged. The vba doesn't make it highlighted in the new filter column.
This comment was minimized by the moderator on the site
Hi,
Thank you for your comment.
The problem you mentioned is too complicated to acheive now. We will try our best to solve it as soon as possible and let you know after we figure it out.
This comment was minimized by the moderator on the site
To Correct this, change:
If .On Then

xRg.Offset(, I - xRgCol).Interior.Color = 16736553

End If

To:
If .On Then

xRg.Offset(, I - xRgCol).Interior.Color = 16736553

Else

xRg.Offset(, I - xRgCol).Interior.Color = 16777215

End If



Not it will remove the color.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations