Skip i'r prif gynnwys

Sut i ddefnyddio botwm i ddangos colofnau cuddio yn Excel?

Bydd yr erthygl hon yn dangos i chi ddulliau o greu a defnyddio botwm i ddangos a chuddio colofnau yn Excel.

Defnyddiwch botwm i ddangos colofnau cuddio gyda'r botwm Toggle
Defnyddiwch y botwm i ddangos cuddio colofnau gyda Kutools for Excel


Defnyddiwch botwm i ddangos colofnau cuddio gyda'r botwm Toggle

Gallwch greu botwm Toggle i ddangos colofnau cuddio trwy ei glicio. Gwnewch fel a ganlyn.

1. Cliciwch Datblygwr > Mewnosod > Botwm Toglo (Rheoli ActiveX). Gweler y screenshot:

Nodyn: Os na welwch y Datblygwr tab ar y Rhuban, cliciwch tab datblygwr dangos / arddangos yn Excel gwybod sut i'w alluogi.

2. Tynnwch botwm Toggle ar y daflen waith. Cliciwch ar y dde, ac yna dewiswch Gweld y Cod o'r ddewislen clicio ar y dde. Gweler y screenshot:

3. Yn yr agored Cymwysiadau Sylfaenol Gweledol Microsoft ffenestr, disodli'r holl gynnwys yn y ffenestr cod gyda chod VBA islaw.

Cod VBA: botwm i ddangos colofnau cuddio

Private Sub ToggleButton1_Click()
Dim xAddress As String
xAddress = "F:G"
If ToggleButton1.Value Then
    Application.ActiveSheet.Columns(xAddress).Hidden = True
Else
    Application.ActiveSheet.Columns(xAddress).Hidden = False
End If
End Sub

Nodyn: Mae “F: G” yn y cod yn golygu y bydd colofnau F: G yn cael eu dangos a’u cuddio wrth redeg y cod. Os gwelwch yn dda eu newid i'ch anghenion.

4. Gwasgwch Alt + Q allweddi ar yr un pryd i gau'r Cymwysiadau Sylfaenol Gweledol Microsoft ffenestr.

5. Trowch oddi ar y Modd Dylunio gyda chlicio Datblygwr > Modd Dylunio.

Nawr pan gliciwch y botwm toggle, mae'r colofnau penodedig wedi'u cuddio ar unwaith.

Wrth glicio arno eto, mae'r colofnau'n cael eu harddangos.


Defnyddiwch y botwm i ddangos cuddio colofnau gyda Kutools for Excel

Os oes colofnau eisoes wedi'u cuddio yn eich taflen waith, Kutools for Excel'S Toglo i guddio / cuddio'r holl golofn (au) cudd gall cyfleustodau eich helpu i'w dangos a'u cuddio yn gyflym gydag un clic yn unig.

Cyn gwneud cais Kutools for Excel, os gwelwch yn dda ei lawrlwytho a'i osod yn gyntaf.

1. Cliciwch Kutools > Llywio.

2. Newid i'r Rhestr golofnau cwarel, ac yna gallwch glicio ar y Toglo i guddio / cuddio'r holl golofn (au) cudd botwm i ddangos / cuddio colofnau yn y daflen waith gyfredol.

  Os ydych chi am gael treial am ddim (30-day) o'r cyfleustodau hwn, cliciwch i'w lawrlwytho, ac yna ewch i gymhwyso'r llawdriniaeth yn ôl y camau uchod.


Defnyddiwch y botwm i ddangos cuddio colofnau gyda Kutools for Excel

Offer Cynhyrchiant Swyddfa Gorau

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 for Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed o'r blaen. Kutools for 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...

tab kte 201905


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 (13)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi what is the code to hide rows instead of columns
Thanks
This comment was minimized by the moderator on the site
Hi Andy,
This VBA code can help. Please give it a try. Thank you.
You need to change the row number in the xAddress line to the rows you want to hide.
Private Sub ToggleButton1_Click()
'Updated by Extendoffice 20230915
Dim xAddress As String
xAddress = "5:10"
If ToggleButton1.Value Then
    Application.ActiveSheet.Rows(xAddress).Hidden = True
Else
    Application.ActiveSheet.Rows(xAddress).Hidden = False
End If
End Sub
This comment was minimized by the moderator on the site
Bonjour,

Top cela fonctionne bien !!

Cependant dans mon cas de figure je masque plusieurs groupes de colonnes ( ex : un bouton 1 pour masquer les colonnes D:E et un bouton 2 pour masquer les colonnes I:K). Comment faire pour que je puisse masquer un groupe de colonnes de façon indépendante et que je ne sois pas obligé d'activer le bouton 1 afin de pouvoir activer le bouton 2 ?

Je débute merci d'avance :)
This comment was minimized by the moderator on the site
Great written tutorial, but how do I create this button on a shared Excel sheet?
This comment was minimized by the moderator on the site
Hi Madison Taylor Delgado,
Are your workbooks shared on OneDrive or other applications? I am not able to solve this problem yet. Sorry for that.
This comment was minimized by the moderator on the site
Bom dia!

Eu gostaria de ajuda com um código para Control ActiveX onde eu pudesse selecionar colunas intercaladas.

Obrigado
This comment was minimized by the moderator on the site
I tried the formula on 3 buttons. The problem is they hide and unhide according to the sequenced they are inputted in the code. Is there anyway that I can click any button that will show/hide the columns not in sequence?
This comment was minimized by the moderator on the site
Adding to Ryan's comment, how about hiding a column based on the value of a cell? Basically making the xAdress an IF-function and not a predetermined range of columns.
This comment was minimized by the moderator on the site
Dear Liz,

Thank you for your comment!

VBA code in this tutorial can help you hiding specified columns based on the value of a cell. Please follow the below hyperlink to know more details.
https://www.extendoffice.com/documents/excel/2682-excel-hide-columns-based-on-dropdown-list.html
This comment was minimized by the moderator on the site
Hi there, How would you change it to select a bunch of non-adjacent cells?
This comment was minimized by the moderator on the site
Dear Ryan,

If you need to select a bunch of non-adjacent cells (every selected cell is interval of X cell) as below screenshot shown, please try the Select Interval Rows & Columns utility of Kutools for Excel.

You can also follow this link to know more about this feature. Thank you!
https://www.extendoffice.com/product/kutools-for-excel/excel-select-interval-rows-or-columns.html
This comment was minimized by the moderator on the site
Dear Ryan,

About the bunch of non-adjacent cells you need to select, can you provide a screenshot to show where they locating in your worksheet?
Thank you for your comment.
This comment was minimized by the moderator on the site
This was very helpful, thanks!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations