Skip i'r prif gynnwys

Sut i dynnu sylw at bennawd colofn neu golofn os caiff ei hidlo yn Excel?

Ar gyfer tabl â cholofnau lluosog, nid yw'n hawdd darganfod pa golofn sy'n cael ei hidlo ar gip gan nad oes symbol amlwg ar gyfer y golofn wedi'i hidlo heblaw am a marc. Os ydych chi am sicrhau bod y golofn wedi'i hidlo yn rhagorol mewn tabl, gall dull yn yr erthygl hon eich helpu chi.

Tynnwch sylw at bennawd colofn neu golofn gyfan os caiff ei hidlo â chod VBA


Tynnwch sylw at bennawd colofn neu golofn gyfan os caiff ei hidlo â chod VBA

Fel islaw'r screenshot a ddangosir, mae angen i chi dynnu sylw at y golofn gyfan neu ddim ond pennawd y golofn os yw'r golofn hon wedi'i hidlo mewn ystod tabl, cymhwyswch y codau VBA canlynol.

1. Gwasgwch y Alt + F11 allweddi i agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Yn ffenestr Microsoft Visual Basic for Applications, cliciwch Mewnosod > Modiwlau. Yna copïwch y cod VBA isod i mewn i ffenestr y Modiwl.

Cod VBA: Tynnwch sylw at bennawd y golofn os yw'r golofn wedi'i hidlo

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

I dynnu sylw at y golofn gyfan os yw wedi'i hidlo mewn tabl, copïwch a gludwch y cod VBA isod i mewn i ffenestr y Modiwl.

Cod VBA: Tynnwch sylw at y golofn gyfan os caiff ei hidlo

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. Gwasgwch y F5 allwedd i redeg y cod. Yn y popping up Kutools ar gyfer Excel blwch deialog, dewiswch gell gyntaf y tabl sydd ei hangen arnoch i dynnu sylw at bennawd y golofn wedi'i hidlo neu'r golofn gyfan wedi'i hidlo, ac yna cliciwch ar y OK botwm.

Yna bydd pennawd y golofn neu'r golofn gyfan yn cael ei hamlygu ar unwaith os yw'r golofn yn cael ei hidlo mewn tabl penodol. Gweler sgrinluniau:

Tynnwch sylw at bennawd y golofn os yw'r golofn wedi'i hidlo yn y tabl:

Tynnwch sylw at y golofn gyfan os caiff ei hidlo yn y tabl:

Offer Cynhyrchiant Swyddfa Gorau

🤖 Kutools AI Aide: Chwyldro dadansoddi data yn seiliedig ar: Cyflawniad Deallus   |  Cynhyrchu Cod  |  Creu Fformiwlâu Personol  |  Dadansoddi Data a Chynhyrchu Siartiau  |  Invoke Swyddogaethau Kutools...
Nodweddion Poblogaidd: Darganfod, Amlygu neu Adnabod Dyblygiadau   |  Dileu Rhesi Gwag   |  Cyfuno Colofnau neu Gelloedd heb Colli Data   |   Rownd heb Fformiwla ...
Super-edrych: VLookup Meini Prawf Lluosog    VLookup Gwerth Lluosog  |   VLookup Ar Draws Taflenni Lluosog   |   Edrych Niwlog ....
Rhestr gwympo Uwch: Creu Rhestr Gollwng yn Gyflym   |  Rhestr Gollwng Dibynnol   |  Rhestr Gollwng Aml-ddewis ....
Rheolwr Colofn: Ychwanegu Nifer Penodol o Golofnau  |  Symud Colofnau  |  Toglo Statws Gwelededd Colofnau Cudd  |  Cymharwch Ystodau a Cholofnau ...
Nodweddion dan Sylw: Ffocws ar y Grid   |  Golwg Dylunio   |   Bar Fformiwla Mawr    Rheolwr Llyfr Gwaith a Thaflen   |  Llyfrgell Adnoddau (Testun Auto)   |  Dewiswr Dyddiad   |  Cyfuno Taflenni Gwaith   |  Amgryptio/Dadgryptio Celloedd    Anfon E-byst trwy Restr   |  Hidlo Super   |   Hidlo Arbennig (hidlo mewn print trwm/italig/strikethrough...) ...
15 Set Offer Gorau12 Testun offer (Ychwanegu Testun, Dileu Cymeriadau,...)   |   50 + Siart Mathau (Siart Gantt,...)   |   40+ Ymarferol Fformiwlâu (Cyfrifwch oedran yn seiliedig ar ben-blwydd,...)   |   19 mewnosod offer (Mewnosod Cod QR, Mewnosod Llun o'r Llwybr,...)   |   12 Trosi offer (Rhifau i Eiriau, Trosi arian cyfred,...)   |   7 Uno a Hollti offer (Rhesi Cyfuno Uwch, Celloedd Hollt,...)   |   ... a mwy

Supercharge Eich Sgiliau Excel gyda Kutools ar gyfer Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed. Kutools ar gyfer Excel Yn Cynnig Dros 300 o Nodweddion Uwch i Hybu Cynhyrchiant ac Arbed Amser.  Cliciwch Yma i Gael Y Nodwedd Sydd Ei Angen Y Mwyaf...

Disgrifiad


Mae Office Tab yn dod â rhyngwyneb Tabbed i Office, ac yn Gwneud Eich Gwaith yn Haws o lawer

  • Galluogi golygu a darllen tabbed yn Word, Excel, PowerPoint, Cyhoeddwr, Mynediad, Visio a Phrosiect.
  • Agor a chreu dogfennau lluosog mewn tabiau newydd o'r un ffenestr, yn hytrach nag mewn ffenestri newydd.
  • Yn cynyddu eich cynhyrchiant 50%, ac yn lleihau cannoedd o gliciau llygoden i chi bob dydd!
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