Loncat ke daftar isi utama

Bagaimana cara membuat daftar drop-down dengan beberapa kotak centang di Excel?

Banyak pengguna Excel cenderung membuat daftar drop-down dengan beberapa kotak centang untuk memilih beberapa item dari daftar setiap kali. Sebenarnya, Anda tidak dapat membuat daftar dengan beberapa kotak centang dengan Validasi Data. Dalam tutorial ini, kami akan menunjukkan kepada Anda dua metode untuk membuat daftar drop-down dengan beberapa kotak centang di Excel.

Gunakan Kotak Daftar untuk membuat daftar drop-down dengan beberapa kotak centang
J: Buat kotak daftar dengan data sumber
B: Beri nama sel tempat Anda akan menemukan item yang dipilih
C: Sisipkan bentuk untuk membantu mengeluarkan item yang dipilih
Mudah membuat daftar drop-down dengan kotak centang dengan alat yang luar biasa
Tutorial lainnya untuk daftar drop-down ...


Gunakan Kotak Daftar untuk membuat daftar drop-down dengan beberapa kotak centang

Seperti gambar di bawah ini yang ditunjukkan, di lembar kerja saat ini, semua nama dalam rentang A2: A11 akan menjadi data sumber dari kotak daftar. Klik pada tombol di sel C4 dapat menampilkan item yang dipilih, dan semua item yang dipilih di kotak daftar akan ditampilkan di sel E4. Untuk mencapai ini, lakukan hal berikut.

A. Membuat kotak daftar dengan data sumber

1. klik Pengembang > Menyisipkan > Kotak Daftar (Kontrol X Aktif). Lihat tangkapan layar:

2. Gambar kotak daftar di lembar kerja saat ini, klik kanan dan kemudian pilih Properties dari menu klik kanan.

3. Dalam Properties kotak dialog, Anda perlu mengkonfigurasi sebagai berikut.

  • 3.1 Dalam DaftarIsiRentang kotak, masukkan kisaran sumber yang akan Anda tampilkan dalam daftar (di sini saya memasukkan kisaran A2: A11);
  • 3.2 Dalam DaftarGaya kotak, pilih 1 - Opsi Gaya fmList;
  • 3.3 Dalam MultiSelect kotak, pilih 1 - fmMultiSelectMulti;
  • 3.4 Tutup Properties kotak dialog. Lihat tangkapan layar:

B: Beri nama sel tempat Anda akan menemukan item yang dipilih

Jika Anda perlu menampilkan semua item yang dipilih ke dalam sel tertentu seperti E4, lakukan hal berikut.

1. Pilih sel E4, masukkan DaftarBoxOutput ke dalam nama Box dan tekan tombol Enter kunci.

C. Menyisipkan bentuk untuk membantu mengeluarkan item yang dipilih

1. klik Menyisipkan > bentuk > Empat persegi panjang. Lihat tangkapan layar:

2. Gambar persegi panjang di lembar kerja Anda (di sini saya menggambar persegi panjang di sel C4). Kemudian klik kanan persegi panjang dan pilih Tetapkan Makro dari menu klik kanan.

3. Dalam Tetapkan Makro kotak dialog, klik New .

4. Dalam pembukaan Microsoft Visual Basic untuk Aplikasi jendela, harap ganti kode asli di Modul jendela dengan kode VBA di bawah ini.

Kode VBA: Buat daftar dengan beberapa kotak centang

Sub Rectangle1_Click()
'Updated by Extendoffice 20200730
Dim xSelShp As Shape, xSelLst As Variant, I, J As Integer
Dim xV As String
Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = ActiveSheet.ListBox1
If xLstBox.Visible = False Then
    xLstBox.Visible = True
    xSelShp.TextFrame2.TextRange.Characters.Text = "Pickup Options"
    xStr = ""
    xStr = Range("ListBoxOutput").Value
    
    If xStr <> "" Then
         xArr = Split(xStr, ";")
    For I = xLstBox.ListCount - 1 To 0 Step -1
        xV = xLstBox.List(I)
        For J = 0 To UBound(xArr)
            If xArr(J) = xV Then
              xLstBox.Selected(I) = True
              Exit For
            End If
        Next
    Next I
    End If
Else
    xLstBox.Visible = False
    xSelShp.TextFrame2.TextRange.Characters.Text = "Select Options"
    For I = xLstBox.ListCount - 1 To 0 Step -1
        If xLstBox.Selected(I) = True Then
        xSelLst = xLstBox.List(I) & ";" & xSelLst
        End If
    Next I
    If xSelLst <> "" Then
        Range("ListBoxOutput") = Mid(xSelLst, 1, Len(xSelLst) - 1)
    Else
        Range("ListBoxOutput") = ""
    End If
End If
End Sub

Catatan: Di dalam kode, Persegi panjang 1 adalah nama bentuk; DaftarKotak1 adalah nama kotak daftar; Pilih Pilihan dan Opsi Penjemputan adalah teks yang ditampilkan dari bentuk; dan DaftarBoxOutput adalah nama rentang sel keluaran. Anda dapat mengubahnya berdasarkan kebutuhan Anda.

5. tekan lain + Q tombol secara bersamaan untuk menutup Microsoft Visual Basic untuk Aplikasi jendela.

6. Klik pada tombol persegi panjang akan melipat atau memperluas kotak daftar. Saat kotak daftar meluas, centang item di kotak daftar, lalu klik persegi panjang lagi untuk menampilkan semua item yang dipilih ke dalam sel E4. Lihat demo di bawah ini:

7. Dan kemudian simpan buku kerja sebagai file Buku Kerja Excel MacroEnable untuk menggunakan kembali kode di masa mendatang.


Buat daftar drop-down dengan kotak centang dengan alat yang luar biasa

Metode di atas terlalu banyak langkah untuk ditangani dengan mudah. Di sini sangat merekomendasikan Daftar Drop-down dengan Kotak Centang kegunaan Kutools untuk Excel untuk membantu Anda membuat daftar drop-down dengan mudah dengan kotak centang dalam kisaran tertentu, lembar kerja saat ini, buku kerja saat ini atau semua buku kerja yang dibuka berdasarkan kebutuhan Anda. Lihat demo di bawah ini:
Unduh dan coba sekarang! (Jejak gratis 30 hari)

Selain demo di atas, kami juga menyediakan panduan langkah demi langkah untuk mendemonstrasikan cara menerapkan fitur ini untuk mencapai tugas ini. Silakan lakukan sebagai berikut.

1. Buka daftar drop-down lembar kerja yang telah Anda setel validasi data, klik Kutools > Daftar Drop-down > Daftar Drop-down dengan Kotak Centang > Pengaturan. Lihat tangkapan layar:

2. Dalam Drop-down List dengan Centang Kotak Pengaturan kotak dialog, konfigurasikan sebagai berikut.

  • 2.1) Di berlaku untuk bagian, tentukan cakupan penerapan tempat Anda akan membuat kotak centang untuk item dalam daftar drop-down. Anda dapat menentukan a kisaran tertentu, lembar kerja saat ini, buku kerja saat ini or semua workbook terbuka berdasarkan kebutuhan Anda.
  • 2.2) Di mode bagian, pilih gaya yang Anda inginkan untuk menampilkan item yang dipilih;
  • Di sini mengambil memodifikasi opsi sebagai contoh, jika Anda memilih ini, nilai sel akan diubah berdasarkan item yang dipilih.
  • 2.3) Di alat pemisah kotak, masukkan pembatas yang akan Anda gunakan untuk memisahkan beberapa item;
  • 2.4) Di Arah Teks bagian, pilih arah teks berdasarkan kebutuhan Anda;
  • 2.5) Klik OK .

3. Langkah terakhir, klik Kutools > Daftar Drop-down > Daftar Drop-down dengan Kotak Centang > Aktifkan Daftar Drop-down Kotak Centang untuk mengaktifkan fitur ini.

Mulai sekarang, ketika Anda mengklik sel dengan daftar drop-down dalam lingkup yang ditentukan, kotak daftar akan muncul, pilih item dengan mencentang kotak centang untuk output ke sel seperti yang ditunjukkan demo di bawah ini (Ambil mode Modifikasi sebagai contoh ).

Untuk detail lebih lanjut tentang fitur ini, silahkan kunjungi disini.

  Jika Anda ingin memiliki uji coba gratis (30 hari) dari utilitas ini, silahkan klik untuk mendownloadnya, lalu lanjutkan untuk menerapkan operasi sesuai langkah di atas.


Artikel terkait:

Pelengkapan otomatis saat mengetik di daftar drop-down Excel
Jika Anda memiliki daftar drop-down validasi data dengan nilai yang besar, Anda perlu menggulir ke bawah dalam daftar hanya untuk menemukan yang tepat, atau langsung mengetikkan seluruh kata ke dalam kotak daftar. Jika ada metode untuk mengizinkan penyelesaian otomatis saat mengetik huruf pertama di daftar tarik-turun, semuanya akan menjadi lebih mudah. Tutorial ini memberikan metode untuk memecahkan masalah tersebut.

Buat daftar drop-down dari buku kerja lain di Excel
Sangat mudah untuk membuat daftar drop-down validasi data di antara lembar kerja dalam buku kerja. Tetapi jika daftar data yang Anda perlukan untuk validasi data ada di buku kerja lain, apa yang akan Anda lakukan? Dalam tutorial ini, Anda akan belajar cara membuat daftar drop fown dari workbook lain di Excel secara detail.

Buat daftar drop-down yang dapat dicari di Excel
Untuk daftar drop-down dengan banyak nilai, menemukan yang tepat bukanlah pekerjaan yang mudah. Sebelumnya kami telah memperkenalkan metode pengisian otomatis daftar drop-down saat memasukkan huruf pertama ke dalam kotak drop-down. Selain fungsi pelengkapan otomatis, Anda juga dapat membuat daftar drop-down dapat dicari untuk meningkatkan efisiensi kerja dalam menemukan nilai yang tepat dalam daftar drop-down. Untuk membuat daftar drop-down dapat dicari, coba metode dalam tutorial ini.

Mengisi otomatis sel lain saat memilih nilai di daftar drop-down Excel
Katakanlah Anda telah membuat daftar drop-down berdasarkan nilai dalam rentang sel B8: B14. Saat Anda memilih nilai apa pun dalam daftar turun bawah, Anda ingin nilai yang sesuai dalam rentang sel C8: C14 secara otomatis terisi dalam sel yang dipilih. Untuk memecahkan masalah, metode dalam tutorial ini akan membantu Anda.

Tutorial lainnya untuk daftar drop-down ...

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 (70)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello-

This is fabulous, but I was wondering if there is a way to call the code as a subroutine, ie Click Button 1, run this code with X List Box and X Output cell. I want to pass the listbox and the output cell as variables into this code. Any help would be greatly appreciated.

I've tried this:
Private Sub Rectangle1_Click()
Call MultiSelctDropdown(ListBox1,Output1)
End Sub

Private Sub Rectangle2_Click()
Call MultiSelctDropdown(ListBox2,Output2)
End Sub

Private Sub MultiSelectDropdown(ListBox As String, Output As String)
Dim xSelShp As Shape, xSelLst As Variant, I, J As Integer
Dim xV As String
Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = ActiveSheet.ListBox
If xLstBox.Visible = False Then
xLstBox.Visible = True
xSelShp.TextFrame2.TextRange.Characters.Text = "Enter"
xStr = ""
xStr = Range("Output").Value

If xStr <> "" Then
xArr = Split(xStr, ",")
For I = xLstBox.ListCount - 1 To 0 Step -1
xV = xLstBox.List(I)
For J = 0 To UBound(xArr)
If xArr(J) = xV Then
xLstBox.Selected(I) = True
Exit For
End If
Next
Next I
End If
Else
xLstBox.Visible = False
xSelShp.TextFrame2.TextRange.Characters.Text = "Click Here to Select Products"
For I = xLstBox.ListCount - 1 To 0 Step -1
If xLstBox.Selected(I) = True Then
xSelLst = xLstBox.List(I) & "," & xSelLst
End If
Next I
If xSelLst <> "" Then
Range("Output") = Mid(xSelLst, 1, Len(xSelLst) - 1)
Else
Range("Output") = ""
End If
End If
End Sub
This comment was minimized by the moderator on the site
Ok I figured this one out (see below)

But now I want to have only ONE list box that I can use over and over again with different buttons but different output depending on the button pushed. And the code below works for this EXCEPT the items selected when the list box pops up includes all items that have been outputted from the code.

If list box1 contains

Apples
Oranges
Pears
Kiwi

and button 1 is pressed and Apples is selected, when button 2 is pressed Apples is already selected, and if during button press 2 pears is selected when you go back to button 1 Apples AND Pears are selected.

How can I either clear all selected when a button is pressed OR make the selected options equal to the output.


Private Sub Button1_Click()
Call ProductSelection(ActiveSheet.ListBox1, "Button1Output", 243, 215)
End Sub
Private Sub Button2_Click()
Call ProductSelection(ActiveSheet.ListBox1, "Button2Output", 472, 215)
End Sub



Private Sub ProductSelection(xListBox As Object, Output As String, left As Integer, height As Integer)
Dim xSelShp As Shape, xSelLst As Variant, I, J As Integer
Dim xV As String
Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = xListBox
If xLstBox.Visible = False Then
xLstBox.Visible = True
xLstBox.left = left
xLstBox.height = height
xSelShp.TextFrame2.TextRange.Characters.Text = "Enter"
xStr = ""
xStr = Range(Output).Value

If xStr <> "" Then
xArr = Split(xStr, ",")
For I = xLstBox.ListCount - 1 To 0 Step -1
xV = xLstBox.List(I)
For J = 0 To UBound(xArr)
If xArr(J) = xV Then
xLstBox.Selected(I) = True
Exit For
End If
Next
Next I
End If
Else
xLstBox.Visible = False
xSelShp.TextFrame2.TextRange.Characters.Text = "Click Here to Select Products"
For I = xLstBox.ListCount - 1 To 0 Step -1
If xLstBox.Selected(I) = True Then
xSelLst = xLstBox.List(I) & "," & xSelLst
End If
Next I
If xSelLst <> "" Then
Range(Output) = Mid(xSelLst, 1, Len(xSelLst) - 1)
Else
Range(Output) = ""
End If
End If
End Sub
This comment was minimized by the moderator on the site
Hi there- this is super helpful, thank you! Can you tell me how I can draw a list box based on a list in a different worksheet (but same file)? I've tried entering my worksheet name (i.e., 'lists') followed by the range in the list fill range (after clicking on Properties) but this does not work.Thanks!
This comment was minimized by the moderator on the site
Hi Meghan,Supposing you want to <span style="letter-spacing: 0.2px; color: inherit; font-family: inherit; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit;">ListBox1</span><span style="letter-spacing: 0.2px; color: inherit; font-family: inherit; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit;">Sheet1</span><div data-tag="code">Sub listboxlistfillrangefromdifferentsheet()
Sheet1.ListBox1.ListFillRange = Sheet2.Range("A2:A20").Address(, , , True)
End Sub
This comment was minimized by the moderator on the site
hello, I have a problem with the list box: to make the list going down, I have to click on the box that allows the list to go down but when I click, it does not go down automatically, I have to click outside the list so that it refreshes and the list goes down, what to do? Thank you
This comment was minimized by the moderator on the site
Hi,You can't scroll ActiveX Listbox by mouse wheel. There is no setting for it.

This comment was minimized by the moderator on the site
Hi, thank you for sharing this! I have a question though, is it possible to populate different cells based on the selected option?For example, instead of having everything in one cell, each selection is populated in the cell below the earlier selection. Thank you!
This comment was minimized by the moderator on the site
Hi faez,
The VBA below helps to populate the selected options in different cells on the same row. Please have a try.

Sub Rectangle2_Click()
'Updated by Extendoffice 20211124
Dim xSelShp As Shape, xSelLst As Variant, I As Integer
Dim xRg As Range
Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = ActiveSheet.ListBox1
If xLstBox.Visible = False Then
xLstBox.Visible = True
xSelShp.TextFrame2.TextRange.Characters.Text = "Pickup Options"
Else
xLstBox.Visible = False
xSelShp.TextFrame2.TextRange.Characters.Text = "Select Options"
Set xRg = Range("ListBoxOutput")
For I = 0 To xLstBox.ListCount - 1
If xLstBox.Selected(I) = True Then
xSelLst = xLstBox.List(I)
xRg.Value = Mid(xSelLst, 1, Len(xSelLst))
Set xRg = xRg.Offset(0, 1)
End If
Next I
End If
End Sub
This comment was minimized by the moderator on the site
Hi Crystal,
Thanks a lot for this code, very helpful and convenient. One question : how to adpat it in order not to have the separator ";" if only one item is selected ?
This comment was minimized by the moderator on the site
Hi Eloi,No separator is displayed when you select only one item in the list.
This comment was minimized by the moderator on the site
Thanks Crystal, the mistake was in my adaptation of the code.
If someone needs to adapt it with a click on a cell instead of a click on a shape, you could try this (with a call to this sub in your sheet, with a condition when your cell is selected)

Sub affichage_liste(xLstBox As MSForms.ListBox, texte1 As String)
'Updated by Extendoffice 20200730
Dim xSelLst As Variant, I, J As Integer
Dim xV As String

If xLstBox.Visible = False Then
xLstBox.Visible = True
xStr = ""
xStr = Range(texte1).Value

If xStr <> "" Then
xArr = Split(xStr, ";")
For I = xLstBox.ListCount - 1 To 0 Step -1
xV = xLstBox.List(I)
For J = 0 To UBound(xArr)
If xArr(J) = xV Then
xLstBox.Selected(I) = True
Exit For
End If
Next
Next I
End If
Else
xLstBox.Visible = False
For I = xLstBox.ListCount - 1 To 0 Step -1
If xLstBox.Selected(I) = True Then
xSelLst = xLstBox.List(I) & "; " & xSelLst
End If
Next I
If xSelLst <> "" Then
Range(texte1) = Mid(xSelLst, 1, Len(xSelLst) - 2)
Else
Range(texte1) = ""
End If
End If
End Sub
This comment was minimized by the moderator on the site
Hi Eloi,The code you provided doesn't seem to work. I have modified it again as below.  After adding the code in your Sheet(Code) window, go back to the worksheet, click the cell C4 to expand the list box, after selecting items from the list box, click on any cell in the worksheet to output the selection, and no separator is displayed when you select only one item in the list.
<div data-tag="code">Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updated by Extendoffice 20211223
Dim xSelLst As Variant, I, J As Integer
Dim xV As String
Set xLstBox = ActiveSheet.ListBox1

If Target.Address = "$C$4" Then


If xLstBox.Visible = False Then
xLstBox.Visible = True
xStr = ""
xStr = Range("ListBoxOutput").Value

If xStr <> "" Then
xArr = Split(xStr, ";")
For I = xLstBox.ListCount - 1 To 0 Step -1
xV = xLstBox.List(I)
For J = 0 To UBound(xArr)
If xArr(J) = xV Then
xLstBox.Selected(I) = True
Exit For
End If
Next
Next I
End If

End If

Else
xLstBox.Visible = False

For I = xLstBox.ListCount - 1 To 0 Step -1
If xLstBox.Selected(I) = True Then
xSelLst = xLstBox.List(I) & "; " & xSelLst
End If
Next I
If xSelLst <> "" Then
Range("ListBoxOutput") = Mid(xSelLst, 1, Len(xSelLst) - 2)
Else
Range("ListBoxOutput") = ""
End If


End If

End Sub
This comment was minimized by the moderator on the site
Thanks a lot Crystal
This comment was minimized by the moderator on the site
Bonjour,Je suis plus que novice sur excel 茅tant sur mac je ne peux utiliser l'outil Kutools j'ai donc tent茅 de cr茅er une liste d茅roulante o霉 l'on peut cocher plusieurs items mais je bloque d猫s le d茅but dans l'onglet d茅veloppeur puisque je n'ai pas du tout l'outil "insert".Merci pour votre aide
This comment was minimized by the moderator on the site
Hi I am newbie to VBA. I tried to execute the code but i get the following error "Run-time error '-2147024809 (80070057)': The Item with the specified name wasn't found". Can you help me with this
This comment was minimized by the moderator on the site
Hi Gowtham,It seem that this error occurs when you running the code directly in the Code editor (the Microsoft Visual Basic for Applications window).After adding the code, please press the Alt + Q keys to close the Microsoft Visual Basic for Applications window. Go back to the worksheet and execute the code by clicking the rectangle button (see the .gif picture in step 6).
This comment was minimized by the moderator on the site
Hi Crystal, even after your tip am getting same error as Gowtham. My error is right after protect my sheet. Would you please help me with this issue?
This comment was minimized by the moderator on the site
Hi Crystal, Even After your tip I am getting same error as Gowtham.
This comment was minimized by the moderator on the site
Hi Mina,Which Excel and Windows version are you using?
This comment was minimized by the moderator on the site
Hello,I added this code to an existing macro template and it is loading the selections correctly, but it is NOT clearing out the x on the selected items..This will be used on/in a template worksheet that has submit button/macro to load the worksheet answers into a hidden worksheet with a data table.And am happy to say the field data loaded to the cell, transferred into my variable, and loaded to the data table as expected.
This code was a HUGE blessing!
I use excel 2016
How do I fix this. I am using this version from below.
Sub Rectangle1_Click()
'Updated by Extendoffice 20200730
Dim xSelShp As Shape, xSelLst As Variant, I, J As Integer
Dim xV As String
Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = ActiveSheet.ListBox1
If xLstBox.Visible = False Then
xLstBox.Visible = True
xSelShp.TextFrame2.TextRange.Characters.Text = "Pickup Options"
xStr = ""
xStr = Range("ListBoxOutput").Value

If xStr <> "" Then
xArr = Split(xStr, ";")
For I = xLstBox.ListCount - 1 To 0 Step -1
xV = xLstBox.List(I)
For J = 0 To UBound(xArr)
If xArr(J) = xV Then
xLstBox.Selected(I) = True
Exit For
End If
Next
Next I
End If
Else
xLstBox.Visible = False
xSelShp.TextFrame2.TextRange.Characters.Text = "Select Options"
For I = xLstBox.ListCount - 1 To 0 Step -1
If xLstBox.Selected(I) = True Then
xSelLst = xLstBox.List(I) & ";" & xSelLst
End If
Next I
If xSelLst <> "" Then
Range("ListBoxOutput") = Mid(xSelLst, 1, Len(xSelLst) - 1)
Else
Range("ListBoxOutput") = ""
End If
End If
End Sub
This comment was minimized by the moderator on the site
Hello,

I'm having a similar problem to Tom from 2 months ago. When I try to share my file with a colleague, the multi-select droplist list isn't working. However, I used the Kutools add-on to create this as opposed to creating it myself. I've also saved it as macro-enabled.
This comment was minimized by the moderator on the site
Hi ben,The multi-select drop down list feature of Kutools only works in the Excel that installed our Kutools. We are working on this issue, sorry for the inconvenience.
This comment was minimized by the moderator on the site
Hello I looking the resolve for problem with saving choosing on drop down list

when i choose something on list and send file to my colleague, then when he open file and want to check my list then list has cleared and cell "ListBoxOutput" was cleared too.

help please :)
This comment was minimized by the moderator on the site
Hi Tom,
Please save the workbook as an "Excel MacroEnable Workbook" and then send this .xlsm file to your colleague.
This comment was minimized by the moderator on the site
hello i save this file in this format from beginning ;), but without effect. still when i fill file and send to someone then when he opened file and click to "shape" then macro started from begin and cleared list
This comment was minimized by the moderator on the site
Hi Tom,
I am sorry for the mistake. The code has been updated again. Please have a try.

Sub Rectangle1_Click()

'Updated by Extendoffice 20200730

Dim xSelShp As Shape, xSelLst As Variant, I, J As Integer

Dim xV As String

Set xSelShp = ActiveSheet.Shapes(Application.Caller)

Set xLstBox = ActiveSheet.ListBox1

If xLstBox.Visible = False Then

xLstBox.Visible = True

xSelShp.TextFrame2.TextRange.Characters.Text = "Pickup Options"

xStr = ""

xStr = Range("ListBoxOutput").Value



If xStr <> "" Then

xArr = Split(xStr, ";")

For I = xLstBox.ListCount - 1 To 0 Step -1

xV = xLstBox.List(I)

For J = 0 To UBound(xArr)

If xArr(J) = xV Then

xLstBox.Selected(I) = True

Exit For

End If

Next

Next I

End If

Else

xLstBox.Visible = False

xSelShp.TextFrame2.TextRange.Characters.Text = "Select Options"

For I = xLstBox.ListCount - 1 To 0 Step -1

If xLstBox.Selected(I) = True Then

xSelLst = xLstBox.List(I) & ";" & xSelLst

End If

Next I

If xSelLst <> "" Then

Range("ListBoxOutput") = Mid(xSelLst, 1, Len(xSelLst) - 1)

Else

Range("ListBoxOutput") = ""

End If

End If

End Sub
This comment was minimized by the moderator on the site
Now it's working perfectly.

Many thanks for your help
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations