Loncat ke daftar isi utama

Bagaimana cara menghubungkan kotak centang ke beberapa sel di Excel?

Tautkan kotak centang ke beberapa sel relatif dapat membantu Anda dengan cepat dan mudah melakukan beberapa penghitungan saat Anda perlu menjumlahkan, menghitung, atau rata-rata hanya sel yang dicentang atau tidak dicentang. Tapi, pernahkah Anda mencoba menautkan kotak centang ke beberapa sel sekaligus di lembar kerja?

Tautkan kotak centang ke beberapa sel dengan rumus satu per satu

Tautkan kotak centang ke beberapa sel sekaligus dengan kode VBA


panah gelembung kanan biru Tautkan kotak centang ke beberapa sel dengan rumus satu per satu

Untuk menautkan kotak centang ke sel tertentu, sebenarnya, Anda dapat menerapkan rumus sederhana untuk menautkannya secara manual.

1. Setelah memasukkan kotak centang pada lembar kerja Anda, untuk memilih kotak centang tersebut, silakan tekan Ctrl kunci dan kemudian klik kotak centang pertama yang ingin Anda tautkan ke sel lain.

2. Kemudian di bilah rumus, ketikkan tanda sama dengan =, lalu klik satu sel yang ingin Anda tautkan kotak centangnya, B2 misalnya, lihat tangkapan layar:

doc-link-multiple-kotak centang-1

3. Lalu tekan Enter pada keyboard, sekarang, saat Anda mencentang kotak ini, sel yang ditautkan akan ditampilkan BENAR, jika tidak dicentang, itu akan ditampilkan SALAH, lihat tangkapan layar:

doc-link-multiple-kotak centang-2

4. Ulangi langkah di atas untuk menautkan kotak centang lain satu per satu.


panah gelembung kanan biru Tautkan kotak centang ke beberapa sel sekaligus dengan kode VBA

Jika ada ratusan dan ribuan kotak centang yang perlu ditautkan ke sel lain, metode pertama tidak akan berfungsi secara efektif, untuk menautkannya ke beberapa sel sekaligus, Anda dapat menerapkan kode VBA berikut. Harap lakukan seperti ini:

1. Masuk ke lembar kerja Anda dengan daftar kotak centang.

2. Tahan ALT + F11 kunci untuk membuka Jendela Microsoft Visual Basic for Applications.

3. Klik Menyisipkan > Modul, dan tempel kode berikut di Jendela Modul.

Kode VBA: tautkan kotak centang ke beberapa sel sekaligus

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. Lalu tekan F5 kunci untuk menjalankan kode ini, semua kotak centang di lembar kerja aktif telah ditautkan ke sel, ketika Anda mencentang kotak centang, sel relatifnya akan ditampilkan BENAR, jika Anda mengosongkan kotak centang, sel yang ditautkan akan ditampilkan SALAH, lihat tangkapan layar:

doc-link-multiple-kotak centang-3

Note: Pada kode di atas, i = 2, nomor 2 adalah baris awal dari kotak centang Anda, dan hurufnya B adalah lokasi kolom tempat Anda perlu menautkan kotak centang. Anda dapat mengubahnya sesuai kebutuhan Anda.


Artikel terkait:

Bagaimana cara memilih semua kotak centang menggunakan satu kotak centang di Excel?

Bagaimana cara cepat memasukkan beberapa kotak centang di Excel?

Bagaimana cara cepat menghapus beberapa kotak centang di Excel?

Alat Produktivitas Kantor Terbaik

馃 Kutools AI Ajudan: Merevolusi analisis data berdasarkan: Eksekusi Cerdas   |  Hasilkan Kode  |  Buat Rumus Khusus  |  Analisis Data dan Hasilkan Grafik  |  Aktifkan Fungsi Kutools...
Fitur Populer: Temukan, Sorot, atau Identifikasi Duplikat   |  Hapus Baris Kosong   |  Gabungkan Kolom atau Sel tanpa Kehilangan Data   |   Putaran tanpa Formula ...
Pencarian Super: VLookup Beberapa Kriteria    VLookup Nilai Berganda  |   VLookup di Beberapa Lembar   |   Pencarian Fuzzy ....
Daftar Drop-down Lanjutan: Buat Daftar Drop Down dengan Cepat   |  Daftar Drop Down yang Bergantung   |  Multi-pilih Drop Down List ....
Manajer Kolom: Tambahkan Jumlah Kolom Tertentu  |  Pindahkan Kolom  |  Alihkan Status Visibilitas Kolom Tersembunyi  |  Bandingkan Rentang & Kolom ...
Fitur Unggulan: Fokus Kisi   |  Tampilan Desain   |   Bar Formula Besar    Manajer Buku Kerja & Lembar   |  Perpustakaan Sumberdaya (Teks otomatis)   |  Pemetik tanggal   |  Gabungkan Lembar Kerja   |  Enkripsi/Dekripsi Sel    Kirim Email berdasarkan Daftar   |  Filter Super   |   Filter Khusus (filter tebal/miring/coret...) ...
15 Perangkat Teratas12 Teks Tools (Tambahkan Teks, Hapus Karakter, ...)   |   50 + Grafik jenis (Gantt Chart, ...)   |   40+ Praktis Rumus (Hitung usia berdasarkan ulang tahun, ...)   |   19 Insersi Tools (Masukkan Kode QR, Sisipkan Gambar dari Jalur, ...)   |   12 Konversi Tools (Angka ke Kata, Konversi Mata Uang, ...)   |   7 Gabungkan & Pisahkan Tools (Lanjutan Gabungkan Baris, Pisahkan Sel, ...)   |   ... dan banyak lagi

Tingkatkan Keterampilan Excel Anda dengan Kutools for Excel, dan Rasakan Efisiensi yang Belum Pernah Ada Sebelumnya. Kutools for Excel Menawarkan Lebih dari 300 Fitur Lanjutan untuk Meningkatkan Produktivitas dan Menghemat Waktu.  Klik Di Sini untuk Mendapatkan Fitur yang Paling Anda Butuhkan...

Deskripsi Produk


Tab Office Membawa antarmuka Tab ke Office, dan Membuat Pekerjaan Anda Jauh Lebih Mudah

  • Aktifkan pengeditan dan pembacaan tab di Word, Excel, PowerPoint, Publisher, Access, Visio, dan Project.
  • Buka dan buat banyak dokumen di tab baru di jendela yang sama, bukan di jendela baru.
  • Meningkatkan produktivitas Anda sebesar 50%, dan mengurangi ratusan klik mouse untuk Anda setiap hari!
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