انتقل إلى المحتوى الرئيسي

كيفية إنشاء قائمة منسدلة مع مربعات اختيار متعددة في إكسيل؟

يميل العديد من مستخدمي Excel إلى إنشاء قائمة منسدلة مع مربعات اختيار متعددة من أجل تحديد عناصر متعددة من القائمة في كل مرة. في الواقع ، لا يمكنك إنشاء قائمة بمربعات اختيار متعددة باستخدام التحقق من صحة البيانات. في هذا البرنامج التعليمي ، سنعرض لك طريقتين لإنشاء قائمة منسدلة مع مربعات اختيار متعددة في Excel.

استخدم List Box لإنشاء قائمة منسدلة مع مربعات اختيار متعددة
ج: إنشاء مربع قائمة ببيانات المصدر
ب: قم بتسمية الخلية التي ستحدد فيها العناصر المحددة
ج: أدخل شكلًا للمساعدة في إخراج العناصر المحددة
يمكنك بسهولة إنشاء قائمة منسدلة باستخدام مربعات اختيار باستخدام أداة رائعة
المزيد من البرامج التعليمية للقائمة المنسدلة ...


استخدم List Box لإنشاء قائمة منسدلة مع مربعات اختيار متعددة

كما هو موضح أدناه ، في ورقة العمل الحالية ، ستكون جميع الأسماء الموجودة في النطاق A2: A11 هي البيانات المصدر لمربع القائمة. يمكن أن يؤدي النقر فوق الزر الموجود في الخلية C4 إلى إخراج العناصر المحددة ، وسيتم عرض جميع العناصر المحددة في مربع القائمة في الخلية E4. لتحقيق ذلك ، يرجى القيام بما يلي.

أ. إنشاء مربع قائمة ببيانات المصدر

1. انقر المطور > إدراج > مربع القائمة (عنصر تحكم نشط X). انظر لقطة الشاشة:

2. ارسم مربع قائمة في ورقة العمل الحالية ، وانقر بزر الماوس الأيمن فوقه ثم حدد عقارات من قائمة النقر بزر الماوس الأيمن.

3. في ال عقارات مربع الحوار ، تحتاج إلى تكوين على النحو التالي.

  • 3.1 في ListFillRange في المربع ، أدخل نطاق المصدر الذي ستعرضه في القائمة (هنا أدخل النطاق A2: A11);
  • 3.2 في نمط قائمة مربع، حدد 1 - خيار نمط قائمة fmList;
  • 3.3 في تحديد متعدد مربع، حدد 1 - FMMultiSelectMulti;
  • 3.4 أغلق ملف عقارات صندوق المحادثة. انظر لقطة الشاشة:

ب: قم بتسمية الخلية التي ستحدد فيها العناصر المحددة

إذا كنت بحاجة إلى إخراج جميع العناصر المحددة في خلية محددة مثل E4 ، فيرجى القيام بما يلي.

1. حدد الخلية E4 ، أدخل ListBoxOutput في اسم صندوق واضغط على أدخل الرئيسية.

ج- قم بإدراج شكل للمساعدة في إخراج العناصر المحددة

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 هو اسم الشكل ؛ ListBox1 هو اسم مربع القائمة ؛ اشر على الخيارات و خيارات الالتقاط هي النصوص المعروضة للشكل ؛ و ال ListBoxOutput هو اسم النطاق لخلية الإخراج. يمكنك تغييرها بناءً على احتياجاتك.

5. صحافة قديم + Q مفاتيح في نفس الوقت لإغلاق ميكروسوفت فيسوال باسيك للتطبيقات نافذة.

6. انقر فوق الزر "مستطيل" سيتم طي أو توسيع مربع القائمة. عندما يتم توسيع مربع القائمة ، حدد العناصر الموجودة في مربع القائمة ، ثم انقر فوق المستطيل مرة أخرى لإخراج جميع العناصر المحددة في الخلية E4. انظر أدناه التجريبي:

7. ثم احفظ المصنف كملف Excel MacroEnable المصنف لإعادة استخدام الكود في المستقبل.


قم بإنشاء قائمة منسدلة مع مربعات اختيار باستخدام أداة مذهلة

الطريقة المذكورة أعلاه متعددة الخطوات للتعامل معها بسهولة. هنا نوصي بشدة قائمة منسدلة مع مربعات اختيار فائدة كوتولس Excel لمساعدتك في إنشاء قائمة منسدلة بسهولة مع مربعات اختيار في نطاق محدد أو ورقة عمل حالية أو مصنف حالي أو جميع المصنفات المفتوحة بناءً على احتياجاتك. انظر العرض أدناه:
قم بتنزيله وجربه الآن! (مسار مجاني لمدة 30 يومًا)

إلى جانب العرض التوضيحي أعلاه ، نقدم أيضًا دليلًا تفصيليًا لشرح كيفية تطبيق هذه الميزة لتحقيق هذه المهمة. الرجاء القيام بما يلي.

1. افتح ورقة العمل التي قمت بتعيين القائمة المنسدلة للتحقق من صحة البيانات ، انقر فوق كوتولس > قائمة منسدلة > قائمة منسدلة مع مربعات اختيار > الإعدادات. انظر لقطة الشاشة:

2. في ال قائمة منسدلة مع إعدادات مربعات الاختيار مربع الحوار ، يرجى تكوين على النحو التالي.

  • شنومكس) في التسجيل في ، حدد نطاق التطبيق حيث ستنشئ مربعات اختيار للعناصر في القائمة المنسدلة. يمكنك تحديد ملف نطاق معين, ورقة العمل الحالية, المصنف الحالي or كل المصنفات المفتوحة على أساس الاحتياجات الخاصة بك.
  • شنومكس) في موضة قسم ، اختر النمط الذي تريد إخراج العناصر المحددة ؛
  • هنا يأخذ عدل كمثال ، إذا اخترت هذا ، فسيتم تغيير قيمة الخلية بناءً على العناصر المحددة.
  • شنومكس) في الفاصل مربع ، أدخل المحدد الذي ستستخدمه لفصل العناصر المتعددة ؛
  • شنومكس) في اتجاه النص القسم ، حدد اتجاه النص بناءً على احتياجاتك ؛
  • شنومكس) انقر فوق OK .

3. الخطوة الأخيرة ، انقر فوق كوتولس > قائمة منسدلة > قائمة منسدلة مع مربعات اختيار > تمكين القائمة المنسدلة لخانات الاختيار لتفعيل هذه الميزة.

من الآن فصاعدًا ، عند النقر فوق الخلايا ذات القائمة المنسدلة في نطاق محدد ، سينبثق مربع قائمة ، يرجى تحديد العناصر عن طريق تحديد مربعات الاختيار لإخراجها في الخلية كما هو موضح أدناه (خذ وضع التعديل كمثال ).

لمزيد من التفاصيل حول هذه الميزة ، الرجاء زيارة هنا.

  إذا كنت ترغب في الحصول على نسخة تجريبية مجانية (30 يومًا) من هذه الأداة المساعدة ، الرجاء الضغط لتنزيلهثم انتقل لتطبيق العملية حسب الخطوات المذكورة أعلاه.


مقالات ذات صلة:

الإكمال التلقائي عند الكتابة في قائمة Excel المنسدلة
إذا كانت لديك قائمة منسدلة للتحقق من صحة البيانات بقيم كبيرة ، فأنت بحاجة إلى التمرير لأسفل في القائمة فقط للعثور على الكلمة المناسبة ، أو كتابة الكلمة بأكملها في مربع القائمة مباشرةً. إذا كانت هناك طريقة للسماح بالإكمال التلقائي عند كتابة الحرف الأول في القائمة المنسدلة ، فسيصبح كل شيء أسهل. يوفر هذا البرنامج التعليمي طريقة حل المشكلة.

قم بإنشاء قائمة منسدلة من مصنف آخر في Excel
من السهل جدًا إنشاء قائمة منسدلة للتحقق من صحة البيانات بين أوراق العمل داخل المصنف. ولكن إذا كانت بيانات القائمة التي تحتاجها للتحقق من صحة البيانات موجودة في مصنف آخر ، فماذا ستفعل؟ في هذا البرنامج التعليمي ، ستتعلم كيفية إنشاء قائمة منسدلة من مصنف آخر في Excel بالتفصيل.

قم بإنشاء قائمة منسدلة قابلة للبحث في Excel
بالنسبة للقائمة المنسدلة ذات القيم المتعددة ، فإن العثور على قائمة مناسبة ليس بالأمر السهل. قدمنا ​​سابقًا طريقة قائمة منسدلة للإكمال التلقائي عند إدخال الحرف الأول في المربع المنسدل. إلى جانب وظيفة الإكمال التلقائي ، يمكنك أيضًا جعل القائمة المنسدلة قابلة للبحث لتحسين كفاءة العمل في العثور على القيم المناسبة في القائمة المنسدلة. لجعل القائمة المنسدلة قابلة للبحث ، جرب الطريقة الموجودة في هذا البرنامج التعليمي.

ملء الخلايا الأخرى تلقائيًا عند تحديد القيم في القائمة المنسدلة في Excel
لنفترض أنك قمت بإنشاء قائمة منسدلة بناءً على القيم الموجودة في نطاق الخلايا B8: B14. عند تحديد أي قيمة في القائمة المنسدلة ، فأنت تريد ملء القيم المقابلة في نطاق الخلايا C8: C14 تلقائيًا في خلية محددة. لحل المشكلة ، ستفيدك الطرق الموجودة في هذا البرنامج التعليمي.

المزيد من البرامج التعليمية للقائمة المنسدلة ...

أفضل أدوات إنتاجية المكتب

🤖 مساعد Kutools AI: إحداث ثورة في تحليل البيانات على أساس: التنفيذ الذكي   |  إنشاء التعليمات البرمجية  |  إنشاء صيغ مخصصة  |  تحليل البيانات وإنشاء الرسوم البيانية  |  استدعاء وظائف Kutools...
الميزات الشعبية: البحث عن التكرارات أو تمييزها أو تحديدها   |  حذف الصفوف الفارغة   |  دمج الأعمدة أو الخلايا دون فقدان البيانات   |   جولة بدون صيغة 
سوبر بحث: معايير متعددة VLookup    VLookup ذات القيمة المتعددة  |   VLookup عبر أوراق متعددة   |   بحث غامض ....
قائمة منسدلة متقدمة: إنشاء القائمة المنسدلة بسرعة   |  القائمة المنسدلة التابعة   |  قائمة منسدلة متعددة التحديد ....
مدير العمود: إضافة عدد محدد من الأعمدة  |  نقل الأعمدة  |  تبديل حالة رؤية الأعمدة المخفية  |  مقارنة النطاقات والأعمدة 
الميزات المميزة: التركيز على الشبكة   |  عرض تصميم   |   شريط الفورمولا الكبير    مدير المصنفات والأوراق   |  مكتبة الموارد (النص السيارات)   |  منتقي التاريخ   |  اجمع أوراق العمل   |  تشفير/فك تشفير الخلايا    إرسال رسائل البريد الإلكتروني عن طريق القائمة   |  سوبر تصفية   |   مرشح خاص (تصفية غامق / مائل / يتوسطه خط ...) ...
أفضل 15 مجموعة أدوات12 نص الأدوات (إضافة نص, إزالة الأحرف، ...)   |   +50 رسم الأنواع (مخطط جانت، ...)   |   40+ عملي الصيغ (احسب العمر على أساس تاريخ الميلاد، ...)   |   19 إدخال الأدوات (أدخل رمز الاستجابة السريعة, إدراج صورة من المسار، ...)   |   12 تحويل الأدوات (أرقام إلى كلمات, نتيجة تحويل عملة، ...)   |   7 دمج وتقسيم الأدوات (الجمع بين الصفوف المتقدمة, تقسيم الخلايا، ...)   |   ... و اكثر

عزز مهاراتك في Excel باستخدام Kutools for Excel، واختبر كفاءة لم يسبق لها مثيل. يقدم Kutools for Excel أكثر من 300 ميزة متقدمة لتعزيز الإنتاجية وتوفير الوقت.  انقر هنا للحصول على الميزة التي تحتاجها أكثر...

الوصف


يجلب Office Tab الواجهة المبوبة إلى Office ، ويجعل عملك أسهل بكثير

  • تمكين التحرير والقراءة المبوبة في Word و Excel و PowerPointوالناشر والوصول و Visio والمشروع.
  • فتح وإنشاء مستندات متعددة في علامات تبويب جديدة من نفس النافذة ، بدلاً من النوافذ الجديدة.
  • يزيد من إنتاجيتك بنسبة 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