Skip i'r prif gynnwys

Sut i gysylltu blychau gwirio â chelloedd lluosog yn Excel?

Efallai y bydd cysylltu'r blychau gwirio â chelloedd cymharol lluosog yn eich helpu i wneud rhai cyfrifiadau yn gyflym ac yn hawdd pan fydd angen i chi grynhoi, cyfrif neu gyfartaleddu'r celloedd sydd wedi'u gwirio neu heb eu gwirio yn unig. Ond, a ydych erioed wedi ceisio cysylltu'r blychau gwirio â chelloedd lluosog ar unwaith mewn taflen waith?

Cysylltu blychau gwirio â chelloedd lluosog gyda fformiwla fesul un

Cysylltu blychau gwirio â chelloedd lluosog ar unwaith gyda chod VBA


swigen dde glas saeth Cysylltu blychau gwirio â chelloedd lluosog gyda fformiwla fesul un

I gysylltu'r blwch gwirio â chell benodol, mewn gwirionedd, gallwch gymhwyso fformiwla syml i'w cysylltu â llaw.

1. Ar ôl mewnosod y blychau gwirio yn eich taflen waith, i ddewis y blwch gwirio, pwyswch Ctrl allwedd ac yna cliciwch ar y blwch gwirio cyntaf yr ydych am ei gysylltu â chell arall.

2. Yna yn y bar fformiwla, teipiwch yr arwydd cyfartal =, ac yna cliciwch ar un gell rydych chi am gysylltu'r blwch gwirio â, B2 er enghraifft, gweler y screenshot:

doc-link-multip-checkboxes-1

3. Ac yna pwyswch Rhowch allwedd ar y bysellfwrdd, nawr, pan fyddwch chi'n gwirio'r blwch gwirio hwn, bydd y gell gysylltiedig yn arddangos TRUE, os dad-diciwch ef, bydd yn arddangos Anghywir, gweler y screenshot:

doc-link-multip-checkboxes-2

4. Ailadroddwyd y camau uchod i gysylltu blychau gwirio eraill fesul un.


swigen dde glas saeth Cysylltu blychau gwirio â chelloedd lluosog ar unwaith gyda chod VBA

Os oes cannoedd ar filoedd mae angen cysylltu blychau gwirio â chelloedd eraill, ni fydd y dull cyntaf yn gweithio'n effeithiol, i'w cysylltu â chelloedd lluosog ar unwaith, gallwch gymhwyso'r cod VBA canlynol. Gwnewch fel hyn:

1. Ewch i'ch taflen waith gyda'r rhestr o flychau gwirio.

2. Daliwch i lawr y ALT + F11 allweddi i agor y Ffenestr Microsoft Visual Basic for Applications.

3. Cliciwch Mewnosod > Modiwlau, a gludwch y cod canlynol yn y Ffenestr Modiwl.

Cod VBA: cysylltu blychau gwirio â chelloedd lluosog ar unwaith

Sub LinkChecks()
'Update by Extendoffice
Dim xCB
Dim xCChar
i = 2
xCChar = "B"
For Each xCB In ActiveSheet.CheckBoxes
If xCB.Value = 1 Then
    Cells(i, xCChar).Value = True
Else
    Cells(i, xCChar).Value = False
End If
xCB.LinkedCell = Cells(i, xCChar).Address
i = i + 1
Next xCB
End Sub

4. Ac yna pwyswch F5 yn allweddol i redeg y cod hwn, mae'r holl flychau gwirio yn y daflen waith weithredol wedi'u cysylltu â'r celloedd, pan fyddwch chi'n gwirio'r blwch gwirio, bydd ei gell gymharol yn arddangos TRUE, os ydych chi'n clirio blwch gwirio, dylai'r gell gysylltiedig ddangos Anghywir, gweler y screenshot:

doc-link-multip-checkboxes-3

Nodyn: Yn y cod uchod, i = 2, y nifer 2 yw rhes gychwyn eich blwch gwirio, a'r llythyr B yw lleoliad y golofn lle mae angen i chi gysylltu'r blychau gwirio â. Gallwch eu newid i'ch angen.


Erthyglau cysylltiedig:

Sut i ddewis pob blwch gwirio gan ddefnyddio blwch gwirio sengl yn Excel?

Sut i fewnosod blychau gwirio lluosog yn Excel yn gyflym?

Sut i ddileu blychau gwirio lluosog yn Excel yn gyflym?

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 (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Will this work when I try to sort Alphabetically? I've found that when I sort from A-Z, the check boxes do not follow the cells they were originally next to. Will your method help? Thank you!
This comment was minimized by the moderator on the site
My problem is: I am creating a to do list with daily habits. I want to be able to make statistics from it using the true and false from checking the box linked to a cell but do not want to individually do it, but when i use the code nothing happens?
This comment was minimized by the moderator on the site
Hello, Gregor,
The VBA code works well in my workbook.
You can upload your file here, so that we can check where the problem is.
Thank you!
This comment was minimized by the moderator on the site
Здравствуйте.
Подскажите. Возможно ли суммирование чисел в ячейках по установке флажка?

https://drive.google.com/file/d/1qmEnngPDdgWTISJETJ44IkxG-MABfqhh/view?usp=sharing[/img][/b][/u][/b

В ячейке F3 скрыто число 2 а в ячейке G3 скрыто число 0,3, можно ли сделать так чтоб при установки галочки в ячейке Q3 вычислялась сумма.
Сумма вычислений только на строку в диапазоне F3-P3
This comment was minimized by the moderator on the site
great thread and it works for me.
BUT, I need to save the TRUE/FALSE data to another sheet. What is the VBA to save it to another sheet other than the active one?
This comment was minimized by the moderator on the site
How about if you have some empty rows in ColumnA (as per your example) in between checkboxes? Using the above code it gets the linked cells wrong if there are empty rows because it does not skip them. Interested to see the solution
This comment was minimized by the moderator on the site
Did u find any solution for this? Same problem
This comment was minimized by the moderator on the site
Sub LinkCheckBoxes()

Dim chk As CheckBox

Dim lCol As Long

lCol = 1 'number of columns to the right for link



For Each chk In ActiveSheet.CheckBoxes

With chk

.LinkedCell = _

.TopLeftCell.Offset(0, lCol).Address

End With

Next chk



End Sub
This comment was minimized by the moderator on the site
Hello! Nice post about the VBA... but what if there are 3 columns that has checkboxes that needs to be linked in three other columns as well? Let's say columns B, C, and D has checkboxes and should be linked to columns H, I, and J respectively.
This comment was minimized by the moderator on the site
Hi, Having same problem - Have you found out how to get around this? Thanks, Paul
This comment was minimized by the moderator on the site
Hey,

Try this:

Sub LinkCheckBoxes()
Dim chk As CheckBox
Dim lCol As Long
lCol = 2 'number of columns to the right for link

For Each chk In ActiveSheet.CheckBoxes
With chk
.LinkedCell = _
.TopLeftCell.Offset(0, lCol).Address
End With
Next chk

End Sub



If you have for example, checkboxes in D,E,F change "Icol" to 1, so it links to G,H and I, respectively.
This comment was minimized by the moderator on the site
Hi, I have the same issue but did not work for me, can you help please.Thanks
This comment was minimized by the moderator on the site
thank you very much
This comment was minimized by the moderator on the site
Can you help me out with this same problem?
This comment was minimized by the moderator on the site
Can I do this and program the boxes to say something other than true and false?
This comment was minimized by the moderator on the site
Hi, In your VBA code: link checkboxes to multiple cells at once, the code is set up to link the cell below it. How is the code if I want to link the cell to the left of the first one? Thanks!
This comment was minimized by the moderator on the site
i have more than 40000 cell which have checkbox. when i use this code, it takes more than 5 second to process, i define different macros for different cells but i have still the problem, what can i do?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations