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

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

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

قيم مختلفة لقائمة doc المنسدلة 1

إنشاء قائمة منسدلة ولكن إظهار قيمة مختلفة في خلية القائمة المنسدلة


إنشاء قائمة منسدلة ولكن إظهار قيمة مختلفة في خلية القائمة المنسدلة

لإنهاء هذه المهمة ، يرجى اتباع الخطوات التالية خطوة بخطوة:

1. قم بإنشاء اسم نطاق لقيم الخلية التي تريد استخدامها في القائمة المنسدلة ، في هذا المثال ، سأدخل القائمة المنسدلة للاسم في اسم صندوق، ثم اضغط أدخل مفتاح ، انظر لقطة الشاشة:

قيم مختلفة لقائمة doc المنسدلة 2

2. ثم حدد الخلايا التي تريد إدراج القائمة المنسدلة فيها ، وانقر فوق البيانات > التحقق من صحة البيانات > التحقق من صحة البيانات، انظر لقطة الشاشة:

قيم مختلفة لقائمة doc المنسدلة 3

3. في التحقق من صحة البيانات مربع الحوار ، تحت الإعدادات علامة التبويب، اختر قائمة من السماح القائمة المنسدلة ، ثم انقر فوق قيم مختلفة لقائمة doc المنسدلة 5 لتحديد قائمة الاسم التي تريد استخدامها كقيم منسدلة في ملف مصدر مربع الكتابة. انظر لقطة الشاشة:

قيم مختلفة لقائمة doc المنسدلة 4

4. بعد إدراج القائمة المنسدلة ، يرجى النقر بزر الماوس الأيمن فوق علامة تبويب الورقة النشطة وتحديد عرض الرمز من قائمة السياق ، وفتح Microsoft Visual Basic للتطبيقات نافذة ، انسخ والصق الكود التالي في الوحدة النمطية الفارغة:

كود فبا: عرض قيمة مختلفة من القائمة المنسدلة:

Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
    selectedNa = Target.Value
    If Target.Column = 5 Then
        selectedNum = Application.VLookup(selectedNa, ActiveSheet.Range("dropdown"), 2, False)
        If Not IsError(selectedNum) Then
            Target.Value = selectedNum
        End If
    End If
End Sub

قيم مختلفة لقائمة doc المنسدلة 6

ملاحظات: في الكود أعلاه ، الرقم 5 في غضون إذا كان Target.Column = 5 ثم النص البرمجي هو رقم العمود الذي حددته قائمتك المنسدلة ،اسقاط" في هذا selectedNum = Application.VLookup (محددNa ، ActiveSheet.Range ("قائمة منسدلة") ، 2 ، خطأ) الرمز هو اسم النطاق الذي قمت بإنشائه في الخطوة 1. يمكنك تغييرها إلى ما تريد.

5. ثم احفظ وأغلق هذا الرمز ، الآن ، عند تحديد عنصر من القائمة المنسدلة ، يتم عرض قيمة مختلفة نسبية في نفس الخلية ، انظر لقطة الشاشة:

قيم مختلفة لقائمة doc المنسدلة 7


عرض توضيحي: قم بإنشاء قائمة منسدلة ولكن أظهر قيمًا مختلفة في Excel

كوتولس ل إكسيل: مع أكثر من 300 وظيفة إضافية مفيدة في Excel ، يمكنك تجربتها مجانًا دون قيود خلال 30 يومًا. تنزيل وتجربة مجانية الآن!

 

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

🤖 مساعد 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 (44)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello everyone,

About two years ago, @skyyang posted the following formula, which works perfectly:
Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
Dim xRg As Range
selectedNa = Target.Value
If Target.Column = 5 Then
Set xRg = ActiveWorkbook.Names("DropDown").RefersToRange
selectedNum = Application.VLookup(selectedNa, xRg, 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
End If
End If
End Sub


However, I have six sections each needing the same results from the DDL name range. How do I get this formula to apply to more than one column please?

Any help would be greatly appreciated 🙂
This comment was minimized by the moderator on the site
How can I use this formula if the data for the drop down is on a sheet named materials?

Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
selectedNa = Target.Value
If Target.Column = 4 Then
selectedNum = Application.VLookup(selectedNa, ActiveSheet.Range("Material_List"), 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
End If
End If
End Sub
This comment was minimized by the moderator on the site
Can this be applied to certain cells only instead of the whole column? It’s coming back as #N/A for some areas that i don't need this formula for. Thanks
This comment was minimized by the moderator on the site
The code I have used is below:


Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
selectedNa = Target.Value
If Target.Column = 8 Then
selectedNum = Application.VLookup(selectedNa, ActiveSheet.Range("codes"), 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
End If
End If
End Sub



This works exactly how I need it too, however, when I save, close and then re-open the excel document, this has disappeared from the 'View Code' window and I have to re-insert the code again?????

Please help!
This comment was minimized by the moderator on the site
I have even saved the document as a Excel Macro-Enabled Workbook
This comment was minimized by the moderator on the site
Can you do multiple drop down lists like this on the same worksheet tab? How will the vba code be adjusted to accommodate different lists for the sheet?
This comment was minimized by the moderator on the site
Is there a way to return multiple selections to the same field? I.E. I want to show the numbers for Tedi, Dave and Lucy on a single field seperated by a comma.Many thanks.
This comment was minimized by the moderator on the site
This works for me but is there a way to allow multiple selections in the same cell? I.e. I wanted to return the numbers for Tedi, Lucy and Dave in a single field seperated by a comma?
This comment was minimized by the moderator on the site
Can this be done on different sheets? I mean, on sheet1 the range and on sheet2 the dropdown. How do I have to code this? Thanks.
This comment was minimized by the moderator on the site
Hello, Muhammd,To apply the drop down list in different worksheet, the following code may help you:Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
Dim xRg As Range
selectedNa = Target.Value
If Target.Column = 5 Then
Set xRg = ActiveWorkbook.Names("DropDown").RefersToRange
selectedNum = Application.VLookup(selectedNa, xRg, 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
End If
End If
End Sub


Please try, thank you!
This comment was minimized by the moderator on the site
trying to do multiple drop downs sheet 1 , returning different worksheet. Is this possible as when i select in separate dropdown the sam numbers it does not work For example
Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice

selectedNa = Target.Value
If Target.Column = 2 Then
Set xRg = ActiveWorkbook.Names("Supervisors").RefersToRange
selectedNum = Application.VLookup(selectedNa, xRg, 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
selectedNa = Target.Value
End If
End If
selectedNa = Target.Value
If Target.Column = 9 Then
Set xRg = ActiveWorkbook.Names("Earth").RefersToRange
selectedNum = Application.VLookup(selectedNa, xRg, 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
selectedNa = Target.Value

End If
End If
End Sub
This comment was minimized by the moderator on the site
Good morning i hope someone can help me.I used the VBA code above and it worked perfectly giving me my drop down showing me Different Values In Drop Down List Cell.My problem is that I need a second drop down list showing different values in a second list cell, on the same sheet, can anyone help me in doing this Kind Regards Rene
This comment was minimized by the moderator on the site
Se pueden usar diferentes “dropdown” en la misma hoja, para diferentes columnas y con diferentes rangos?Me explico, tengo una hoja en la que los usuarios introducen diferentes datos. En dos columnas 5 y 12 necesito validar la entrada con respecto a dos rangos diferentes de datos. Lo he probado solo con una columna y funciona perfectamente, pero no encuentro la manera de modificar el código VBA para la segunda columna
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