Skip i'r prif gynnwys

Sut i ddefnyddio blwch gwirio i guddio neu guddio taflen waith yn Excel?

Mae blwch gwirio yn nodwedd ddefnyddiol yn Excel. Yma, byddaf yn dangos i chi sut i ddefnyddio blwch gwirio i guddio neu agor taflen waith benodol yn Excel.

Defnyddiwch flwch gwirio i guddio neu guddio taflen waith yn Excel


Defnyddiwch flwch gwirio i guddio neu guddio taflen waith yn Excel

Gan dybio bod gennych flwch gwirio o'r enw blwch gwirio1 yn eich llyfr gwaith. Wrth ddad-wirio'r blwch gwirio hwn, rydych chi am i daflen waith benodol gael ei chuddio'n awtomatig yn y llyfr gwaith hwn, a dad-agor y daflen waith hon wrth wirio'r blwch gwirio. Cyflawnwch ef fel a ganlyn.

1. Agorwch y daflen waith yn cynnwys y Checkbox1, cliciwch ar y dde ar y tab dalen, ac yna cliciwch Gweld y Cod o'r ddewislen clicio ar y dde.

Nodyn: Dylai'r blwch gwirio fod yn flwch gwirio ActiveX wrth fewnosod.

2. Yn y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, copïwch a gludwch y cod VBA isod i mewn i ffenestr y Cod. Gweler y screenshot:

Cod VBA: Defnyddiwch flwch gwirio i guddio neu agor taflen waith benodol

Private Sub CheckBox1_Click()
    On Error Resume Next
    ThisWorkbook.Sheets("Sheet5").Visible = CheckBox1.Value
End Sub

Nodyn: Yn y cod, Sheet5 yw enw'r daflen waith y byddwch chi'n ei chuddio neu'n ei hagor gyda blwch gwirio1. Amnewid enw'r daflen waith yn ôl yr angen.

3. Gwasgwch Alt + Q allweddi ar yr un pryd i gau'r Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

O hyn ymlaen, wrth ddad-wirio'r blwch gwirio1, bydd y daflen waith benodol “Sheet5” yn cael ei chuddio'n awtomatig. A gallwch ei ddangos trwy wirio'r blwch gwirio. Gweler y screenshot:


Erthyglau perthnasol:

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 (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour,
Je cherche à afficher des pages avec des cases à cocher. Les Chekbox sont toutes sur la même feuille de calcul.
J'ai copié le premier code et l'ai dupliquer.

Private Sub CheckBox1_Click()
On Error Resume Next
ThisWorkbook.Sheets("Eplucher, laver, désinfecter").Visible = CheckBox1.Value
End Sub

Private Sub CheckBox2_Click()
On Error Resume Next
ThisWorkbook.Sheets("Tailler fruits et légumes").Visible = CheckBox1.Value
End Sub

Malheureusement, si je ne coche pas la première case ma seconde case ne fonctionne pas. Pourriez-vous m'aider svp
This comment was minimized by the moderator on the site
Hi Sky53,
I seems that you did not change CheckBox1.Value to the corresponding checkbox name in the second VBA code.
Please change the following line in the second code:
ThisWorkbook.Sheets("Tailler fruits et légumes").Visible = CheckBox1.Value
to
ThisWorkbook.Sheets("Tailler fruits et légumes").Visible = CheckBox2.Value
This comment was minimized by the moderator on the site
Hi Crystal,
Is there a function that would reverse this; ie. sheet is hidden unless checkbox is ticked?
This comment was minimized by the moderator on the site
Hi. I'm very new to ActiveX Controls. I am trying to have multiple checkboxes on one sheet that will hide specific sheets and not all of them or the same one every time. These two scenarios have been my experience. What I need to accomplish is:
CheckBox1 hides Sheet2
CheckBox2 hides Sheet3
CheckBox3 hides Sheet4
CheckBox4 hides Sheet5
CheckBox5 hides Sheet6
CheckBox6 hides Sheet7
CheckBox7 hides Sheet8
CheckBox8 hides Sheet9
This comment was minimized by the moderator on the site
Hi Jack,
Just repeat the code and change the checkbox numbers and the sheet names. Try the below code.

Private Sub CheckBox1_Click()

On Error Resume Next

ThisWorkbook.Sheets("Sheet2").Visible = CheckBox1.Value

End Sub

Private Sub CheckBox2_Click()

On Error Resume Next

ThisWorkbook.Sheets("Sheet3").Visible = CheckBox2.Value

End Sub

Private Sub CheckBox3_Click()

On Error Resume Next

ThisWorkbook.Sheets("Sheet4").Visible = CheckBox3.Value

End Sub

Private Sub CheckBox4_Click()

On Error Resume Next

ThisWorkbook.Sheets("Sheet5").Visible = CheckBox4.Value

End Sub

Private Sub CheckBox5_Click()

On Error Resume Next

ThisWorkbook.Sheets("Sheet6").Visible = CheckBox5.Value

End Sub

Private Sub CheckBox6_Click()

On Error Resume Next

ThisWorkbook.Sheets("Sheet7").Visible = CheckBox6.Value

End Sub

Private Sub CheckBox7_Click()

On Error Resume Next

ThisWorkbook.Sheets("Sheet8").Visible = CheckBox7.Value

End Sub

Private Sub CheckBox8_Click()

On Error Resume Next

ThisWorkbook.Sheets("Sheet9").Visible = CheckBox8.Value

End Sub
This comment was minimized by the moderator on the site
Crystal,
Thanks so much...it worked perfectly!
This comment was minimized by the moderator on the site
How do I hide or unhide a sheet with multiple checkbox? For example sheet "MainMenu" need to be hide unless checkbox_1, checkbox_2 & checkbox_3 are checked.
This comment was minimized by the moderator on the site
Funciona perfectamente pero, ¿cómo se pueden ocultar varias hojas con el mismo checkbox? Muchas gracias!
This comment was minimized by the moderator on the site
Basta con copiar la linea tantas veces como se quiera nombrando la hoja que debe ser ocultada.

Private Sub CheckBox1_Click()
On Error Resume Next
ThisWorkbook.Sheets("DB2018").Visible = CheckBox1.Value
ThisWorkbook.Sheets("V2018").Visible = CheckBox1.Value
ThisWorkbook.Sheets("R2018").Visible = CheckBox1.Value
End Sub
This comment was minimized by the moderator on the site
How do you do multiple on the same page? How do i then hide sheet 3 or 4 with a checkbox?
This comment was minimized by the moderator on the site
Private Sub CheckBox1_Click()
On Error Resume Next
ThisWorkbook.Sheets("DB2018").Visible = CheckBox1.Value
ThisWorkbook.Sheets("V2018").Visible = CheckBox1.Value
ThisWorkbook.Sheets("R2018").Visible = CheckBox1.Value
End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations