मुख्य सामग्री पर जाएं

एक्सेल में एकाधिक चेकबॉक्स के साथ ड्रॉप डाउन सूची कैसे बनाएं?

लेखक: सिलुविया अंतिम संशोधित: 2023-02-28

कई एक्सेल उपयोगकर्ता प्रति बार सूची से कई आइटम चुनने के लिए कई चेकबॉक्स के साथ ड्रॉप डाउन सूची बनाते हैं। दरअसल, आप डेटा सत्यापन के साथ एकाधिक चेकबॉक्स वाली सूची नहीं बना सकते हैं। इस ट्यूटोरियल में, हम आपको एक्सेल में एकाधिक चेकबॉक्स के साथ ड्रॉप डाउन सूची बनाने के दो तरीके दिखाने जा रहे हैं।

एकाधिक चेकबॉक्स वाली ड्रॉप डाउन सूची बनाने के लिए सूची बॉक्स का उपयोग करें
उ: स्रोत डेटा के साथ एक सूची बॉक्स बनाएं
बी: उस सेल का नाम बताएं जिसमें आप चयनित आइटम का पता लगाएंगे
सी: चयनित आइटम को आउटपुट करने में सहायता के लिए एक आकृति डालें
एक अद्भुत टूल के साथ आसानी से चेकबॉक्स के साथ ड्रॉप डाउन सूची बनाएं
ड्रॉप डाउन सूची के लिए अधिक ट्यूटोरियल...


एकाधिक चेकबॉक्स वाली ड्रॉप डाउन सूची बनाने के लिए सूची बॉक्स का उपयोग करें

जैसा कि नीचे स्क्रीनशॉट में दिखाया गया है, वर्तमान वर्कशीट में, श्रेणी A2:A11 के सभी नाम सूची बॉक्स का स्रोत डेटा होंगे। सेल C4 में बटन पर क्लिक करने से चयनित आइटम आउटपुट हो सकते हैं, और सूची बॉक्स में सभी चयनित आइटम सेल E4 में प्रदर्शित होंगे। इसे प्राप्त करने के लिए, कृपया निम्नानुसार कार्य करें।

A. स्रोत डेटा के साथ एक सूची बॉक्स बनाएं

1। क्लिक करें डेवलपर > सम्मिलित करें > सूची बॉक्स (सक्रिय एक्स नियंत्रण). स्क्रीनशॉट देखें:

2. वर्तमान वर्कशीट में एक सूची बॉक्स बनाएं, उस पर राइट क्लिक करें और फिर चयन करें गुण राइट-क्लिक मेनू से।

3। में गुण डायलॉग बॉक्स, आपको निम्नानुसार कॉन्फ़िगर करना होगा।

  • 3.1 में सूची भरें रेंज बॉक्स, वह स्रोत श्रेणी दर्ज करें जिसे आप सूची में प्रदर्शित करेंगे (यहां मैं श्रेणी दर्ज करता हूं A2: A11);
  • 3.2 में सूची शैली बॉक्स, चयन करें 1 - एफएमलिस्ट स्टाइलऑप्शन;
  • 3.3 में बहु का चयन बॉक्स, चयन करें 1 - एफएममल्टीसेलेक्टमल्टी;
  • 3.4 बंद करें गुण संवाद बकस। स्क्रीनशॉट देखें:

बी: उस सेल का नाम बताएं जिसमें आप चयनित आइटम का पता लगाएंगे

यदि आपको सभी चयनित आइटमों को E4 जैसे निर्दिष्ट सेल में आउटपुट करने की आवश्यकता है, तो कृपया निम्नानुसार करें।

1. सेल E4 का चयन करें, दर्ज करें लिस्टबॉक्सआउटपुट में नाम बॉक्स और दबाएं दर्ज कुंजी।

C. चयनित आइटम को आउटपुट करने में सहायता के लिए एक आकृति सम्मिलित करें

1। क्लिक करें सम्मिलित करें > आकृतियाँ > आयत। स्क्रीनशॉट देखें:

2. अपनी वर्कशीट में एक आयत बनाएं (यहां मैं सेल C4 में आयत बनाता हूं)। फिर आयत पर राइट क्लिक करें और चुनें मैक्रो को असाइन करें राइट-क्लिक मेनू से।

3। में मैक्रो को असाइन करें संवाद बॉक्स में, क्लिक करें नया बटन.

4. उद्घाटन में अनुप्रयोगों के लिए माइक्रोसॉफ्ट विज़ुअल बेसिक विंडो, कृपया मूल कोड को इसमें बदलें मॉड्यूल नीचे दिए गए VBA कोड वाली विंडो।

वीबीए कोड: एकाधिक चेकबॉक्स के साथ एक सूची बनाएं

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

नोट: कोड में आयत1 आकृति का नाम है; सूची बॉक्स1 सूची बॉक्स का नाम है; विकल्प चुनो और पिकअप विकल्प आकृति के प्रदर्शित पाठ हैं; और यह लिस्टबॉक्सआउटपुट आउटपुट सेल का रेंज नाम है। आप अपनी आवश्यकताओं के आधार पर उन्हें बदल सकते हैं।

5। दबाएँ ऑल्ट + Q को बंद करने के लिए एक साथ कुंजियाँ अनुप्रयोगों के लिए माइक्रोसॉफ्ट विज़ुअल बेसिक खिड़की.

6. आयत बटन पर क्लिक करने से सूची बॉक्स मुड़ जाएगा या फैल जाएगा। जब सूची बॉक्स का विस्तार हो रहा हो, तो सूची बॉक्स में आइटम की जाँच करें, और फिर सभी चयनित आइटम को सेल E4 में आउटपुट करने के लिए फिर से आयत पर क्लिक करें। नीचे डेमो देखें:

7. और फिर कार्यपुस्तिका को एक के रूप में सहेजें एक्सेल मैक्रोएनेबल वर्कबुक भविष्य में कोड का पुन: उपयोग करने के लिए।


एक अद्भुत टूल के साथ चेकबॉक्स के साथ ड्रॉप डाउन सूची बनाएं

उपरोक्त विधि इतनी बहु-चरणीय है कि इसे आसानी से संभालना संभव नहीं है। यहाँ अत्यधिक अनुशंसा करते हैं चेक बॉक्स के साथ ड्रॉप-डाउन सूची की उपयोगिता के लिए कुटूल एक्सेल आपकी आवश्यकताओं के आधार पर एक निर्दिष्ट सीमा, वर्तमान कार्यपत्रक, वर्तमान कार्यपुस्तिका या सभी खोली गई कार्यपुस्तिकाओं में चेकबॉक्स के साथ आसानी से ड्रॉप-डाउन सूची बनाने में आपकी सहायता के लिए। नीचे दिया गया डेमो देखें:
अभी डाउनलोड करें और इसे आज़माएं! (30 दिन का निःशुल्क ट्रेल)

उपरोक्त डेमो के अलावा, हम यह प्रदर्शित करने के लिए चरण-दर-चरण मार्गदर्शिका भी प्रदान करते हैं कि इस कार्य को प्राप्त करने के लिए इस सुविधा को कैसे लागू किया जाए। कृपया निम्नानुसार करें.

1. उस वर्कशीट को खोलें जिसे आपने डेटा सत्यापन ड्रॉप-डाउन सूची में सेट किया है, क्लिक करें कुटूल > ड्रॉप डाउन सूची > चेक बॉक्स के साथ ड्रॉप-डाउन सूची > सेटिंग्स. स्क्रीनशॉट देखें:

2। में चेक बॉक्स सेटिंग्स के साथ ड्रॉप-डाउन सूची संवाद बॉक्स, कृपया निम्नानुसार कॉन्फ़िगर करें।

  • 2.1) में पर लागू करें अनुभाग में, आवेदन का दायरा निर्दिष्ट करें जहां आप ड्रॉप-डाउन सूची में आइटम के लिए चेकबॉक्स बनाएंगे। आप एक निर्दिष्ट कर सकते हैं निश्चित सीमा, वर्तमान कार्यपत्रक, वर्तमान कार्यपुस्तिका or सभी खोली गई कार्यपुस्तिकाएँ अपनी आवश्यकताओं पर आधारित है।
  • 2.2) में मोड अनुभाग, वह शैली चुनें जिसे आप चयनित आइटम आउटपुट करना चाहते हैं;
  • यहाँ लेता है सुधारे उदाहरण के तौर पर विकल्प, यदि आप इसे चुनते हैं, तो चयनित आइटम के आधार पर सेल मान बदल दिया जाएगा।
  • 2.3) में विभाजक बॉक्स में, एक सीमांकक दर्ज करें जिसका उपयोग आप एकाधिक आइटमों को अलग करने के लिए करेंगे;
  • 2.4) में पाठ की दिशा अनुभाग, अपनी आवश्यकताओं के आधार पर एक पाठ दिशा का चयन करें;
  • 2.5) क्लिक करें OK बटन.

3. अंतिम चरण, क्लिक करें कुटूल > ड्रॉप डाउन सूची > चेक बॉक्स के साथ ड्रॉप-डाउन सूची > चेक बॉक्स की ड्रॉप-डाउन सूची सक्षम करें इस सुविधा को सक्रिय करने के लिए.

अब से, जब आप एक निर्दिष्ट दायरे में ड्रॉप-डाउन सूची वाले सेल पर क्लिक करते हैं, तो एक सूची बॉक्स पॉप अप हो जाएगा, कृपया सेल में आउटपुट करने के लिए चेकबॉक्स को चेक करके आइटम का चयन करें जैसा कि नीचे दिए गए डेमो में दिखाया गया है (उदाहरण के रूप में संशोधित मोड को लें) ).

इस सुविधा के अधिक विवरण के लिए, कृपया यहाँ जाएँ.

  यदि आप इस उपयोगिता का निःशुल्क परीक्षण (30-दिन) चाहते हैं, कृपया इसे डाउनलोड करने के लिए क्लिक करें, और फिर उपरोक्त चरणों के अनुसार ऑपरेशन लागू करने के लिए जाएं।


संबंधित आलेख:

एक्सेल ड्रॉप डाउन सूची में टाइप करते समय स्वतः पूर्ण
यदि आपके पास बड़े मानों के साथ डेटा सत्यापन ड्रॉप डाउन सूची है, तो आपको उचित सूची खोजने के लिए सूची में नीचे स्क्रॉल करना होगा, या पूरे शब्द को सीधे सूची बॉक्स में टाइप करना होगा। यदि ड्रॉप डाउन सूची में पहला अक्षर टाइप करते समय स्वतः पूर्ण होने की अनुमति देने की कोई विधि है, तो सब कुछ आसान हो जाएगा। यह ट्यूटोरियल समस्या को हल करने की विधि प्रदान करता है।

एक्सेल में किसी अन्य कार्यपुस्तिका से ड्रॉप डाउन सूची बनाएं
किसी कार्यपुस्तिका के भीतर कार्यपत्रकों के बीच डेटा सत्यापन ड्रॉप डाउन सूची बनाना काफी आसान है। लेकिन यदि डेटा सत्यापन के लिए आपको आवश्यक सूची डेटा किसी अन्य कार्यपुस्तिका में मिल जाए, तो आप क्या करेंगे? इस ट्यूटोरियल में, आप विस्तार से सीखेंगे कि एक्सेल में किसी अन्य कार्यपुस्तिका से ड्रॉपडाउन सूची कैसे बनाई जाती है।

एक्सेल में खोजने योग्य ड्रॉप डाउन सूची बनाएं
अनेक मानों वाली ड्रॉप डाउन सूची के लिए, उचित मान ढूँढना कोई आसान काम नहीं है। पहले हमने ड्रॉप डाउन बॉक्स में पहला अक्षर दर्ज करने पर ड्रॉप डाउन सूची को स्वत: पूरा करने की एक विधि पेश की थी। स्वत: पूर्ण फ़ंक्शन के अलावा, आप ड्रॉप डाउन सूची में उचित मान खोजने में कार्य कुशलता बढ़ाने के लिए ड्रॉप डाउन सूची को खोजने योग्य भी बना सकते हैं। ड्रॉप डाउन सूची को खोजने योग्य बनाने के लिए, इस ट्यूटोरियल में दी गई विधि को आज़माएँ।

एक्सेल ड्रॉप डाउन सूची में मानों का चयन करते समय अन्य सेल स्वतः भर जाते हैं
मान लीजिए कि आपने सेल रेंज B8:B14 के मानों के आधार पर एक ड्रॉप डाउन सूची बनाई है। जब आप ड्रॉप डाउन सूची में कोई मान चुनते हैं, तो आप चाहते हैं कि सेल श्रेणी C8:C14 में संबंधित मान चयनित सेल में स्वचालित रूप से पॉप्युलेट हो जाएं। समस्या को हल करने के लिए, इस ट्यूटोरियल में दी गई विधियाँ आपकी मदद करेंगी।

ड्रॉप डाउन सूची के लिए अधिक ट्यूटोरियल...

सर्वोत्तम कार्यालय उत्पादकता उपकरण

🤖 कुटूल्स एआई सहयोगी: निम्न के आधार पर डेटा विश्लेषण में क्रांति लाएं: बुद्धिमान निष्पादन   |  कोड जनरेट करें  |  कस्टम फ़ॉर्मूले बनाएं  |  डेटा का विश्लेषण करें और चार्ट बनाएं  |  कुटूल फ़ंक्शंस का आह्वान करें...
लोकप्रिय सुविधाएँ: डुप्लिकेट ढूंढें, हाइलाइट करें या पहचानें   |  रिक्त पंक्तियाँ हटाएँ   |  डेटा खोए बिना कॉलम या सेल को संयोजित करें   |   फॉर्मूला के बिना गोल ...
सुपर लुकअप: एकाधिक मानदंड VLookup    मल्टीपल वैल्यू वीलुकअप  |   अनेक शीटों में VLookup   |   फजी लुकअप ....
उन्नत ड्रॉप-डाउन सूची: शीघ्रता से ड्रॉप डाउन सूची बनाएं   |  आश्रित ड्रॉप डाउन सूची   |  बहु-चयन ड्रॉप डाउन सूची ....
स्तम्भ प्रबंधक: कॉलमों की एक विशिष्ट संख्या जोड़ें  |  कॉलम ले जाएँ  |  छिपे हुए कॉलम की दृश्यता स्थिति टॉगल करें  |  रेंज और कॉलम की तुलना करें ...
फीचर्ड फीचर्स: ग्रिड फोकस   |  डिजाइन देखें   |   बड़ा फॉर्मूला बार    कार्यपुस्तिका एवं शीट प्रबंधक   |  संसाधन लाइब्रेरी (ऑटो टेक्स्ट)   |  खजूर बीनने वाला   |  कार्यपत्रकों को संयोजित करें   |  एन्क्रिप्ट/डिक्रिप्ट सेल    सूची के अनुसार ईमेल भेजें   |  सुपर फ़िल्टर   |   विशेष फ़िल्टर (फ़िल्टर बोल्ड/इटैलिक/स्ट्राइकथ्रू...) ...
शीर्ष 15 टूलसेट12 टेक्स्ट टूल्स (पाठ जोड़ें, अक्षर हटाएँ, ...)   |   50 + चार्ट प्रकार (गैन्ट चार्ट, ...)   |   40+ प्रैक्टिकल सूत्र (जन्मदिन के आधार पर आयु की गणना करें, ...)   |   19 निवेशन टूल्स (QR कोड डालें, पथ से चित्र सम्मिलित करें, ...)   |   12 रूपांतरण टूल्स (शब्दों को संख्याएँ, मुद्रा रूपांतरण, ...)   |   7 विलय और विभाजन टूल्स (उन्नत संयोजन पंक्तियाँ, विभाजन कोशिकाओं, ...)   |   ... और अधिक

एक्सेल के लिए कुटूल के साथ अपने एक्सेल कौशल को सुपरचार्ज करें, और पहले जैसी दक्षता का अनुभव करें। एक्सेल के लिए कुटूल उत्पादकता बढ़ाने और समय बचाने के लिए 300 से अधिक उन्नत सुविधाएँ प्रदान करता है।  वह सुविधा प्राप्त करने के लिए यहां क्लिक करें जिसकी आपको सबसे अधिक आवश्यकता है...

Description


ऑफिस टैब ऑफिस में टैब्ड इंटरफ़ेस लाता है, और आपके काम को बहुत आसान बनाता है

  • Word, Excel, PowerPoint में टैब्ड संपादन और रीडिंग सक्षम करें, प्रकाशक, एक्सेस, विसियो और प्रोजेक्ट।
  • नई विंडो के बजाय एक ही विंडो के नए टैब में एकाधिक दस्तावेज़ खोलें और बनाएं।
  • आपकी उत्पादकता 50% बढ़ जाती है, और आपके लिए हर दिन सैकड़ों माउस क्लिक कम हो जाते हैं!
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