ไปยังเนื้อหาหลัก

วิธีเติมข้อความอัตโนมัติเมื่อพิมพ์ในรายการแบบเลื่อนลงของ Excel

สำหรับรายการแบบหล่นลงของการตรวจสอบความถูกต้องของข้อมูลที่มีหลายรายการ คุณต้องเลื่อนขึ้นและลงในรายการเพื่อค้นหารายการที่คุณต้องการหรือพิมพ์ทั้งคำลงในกล่องรายการให้ถูกต้อง มีวิธีใดบ้างที่จะทำให้รายการแบบเลื่อนลงเติมข้อความอัตโนมัติเมื่อพิมพ์อักขระที่เกี่ยวข้อง ซึ่งจะช่วยให้ผู้คนทำงานในเวิร์กชีตได้อย่างมีประสิทธิภาพมากขึ้นด้วยรายการแบบหล่นลงในเซลล์ บทช่วยสอนนี้มีสองวิธีที่จะช่วยให้คุณบรรลุเป้าหมาย

สร้างรายการแบบหล่นลงให้เติมข้อความอัตโนมัติด้วยโค้ด VBA
ทำให้รายการแบบเลื่อนลงเติมข้อความอัตโนมัติได้ง่ายๆ ใน 2 วินาที

บทแนะนำเพิ่มเติมสำหรับรายการแบบเลื่อนลง ...


สร้างรายการแบบหล่นลงให้เติมข้อความอัตโนมัติด้วยโค้ด VBA

โปรดทำดังนี้เพื่อทำการเติมข้อความอัตโนมัติในรายการแบบหล่นลงหลังจากพิมพ์ตัวอักษรที่เกี่ยวข้องในเซลล์

ประการแรกคุณต้องแทรกกล่องคำสั่งผสมลงในแผ่นงานและเปลี่ยนคุณสมบัติ
  1. เปิดเวิร์กชีตที่มีเซลล์รายการแบบหล่นลงที่คุณต้องการทำให้เติมอัตโนมัติ
  2. ก่อนที่จะแทรกกล่องคำสั่งผสม คุณต้องเพิ่มแท็บนักพัฒนาลงใน Ribbon ของ Excel หากแท็บนักพัฒนาแสดงบน Ribbon ของคุณ เปลี่ยนเป็นขั้นตอนที่ 3. มิฉะนั้น ให้ทำดังนี้เพื่อให้แท็บนักพัฒนาแสดงในริบบิ้น: คลิก เนื้อไม่มีมัน > Options เพื่อเปิด Options หน้าต่าง. ในเรื่องนี้ ตัวเลือก Excel หน้าต่างคลิก ปรับแต่งริบบิ้น ในบานหน้าต่างด้านซ้ายตรวจสอบไฟล์ ผู้พัฒนา จากนั้นคลิกที่ไฟล์ OK ปุ่ม. ดูภาพหน้าจอ:
  3. คลิก ผู้พัฒนา > สิ่งที่ใส่เข้าไป > กล่องคำสั่งผสม (ActiveX Control).
  4. วาดกล่องคำสั่งผสมในแผ่นงานปัจจุบัน คลิกขวาแล้วเลือก อสังหาริมทรัพย์ จากเมนูคลิกขวา
  5. ตัว Vortex Indicator ได้ถูกนำเสนอลงในนิตยสาร อสังหาริมทรัพย์ โปรดแทนที่ข้อความเดิมในไฟล์ (ชื่อ) ฟิลด์ด้วย TempCombo
  6. ปิดกล้อง โหมดการออกแบบ โดยคลิกที่ ผู้พัฒนา > โหมดการออกแบบ
จากนั้นใช้รหัส VBA ด้านล่าง
  1. คลิกขวาที่แท็บแผ่นงานปัจจุบันแล้วคลิก ดูรหัส จากเมนูบริบท ดูภาพหน้าจอ:
  2. ในการเปิด Microsoft Visual Basic สำหรับแอปพลิเคชัน โปรดคัดลอกและวางโค้ด VBA ด้านล่างลงในหน้าต่าง Code ของแผ่นงาน
    รหัส VBA: เติมข้อความอัตโนมัติเมื่อพิมพ์ในรายการแบบเลื่อนลง
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    'Update by Extendoffice: 2020/01/16
        Dim xCombox As OLEObject
        Dim xStr As String
        Dim xWs As Worksheet
        Dim xArr
        
        Set xWs = Application.ActiveSheet
        On Error Resume Next
        Set xCombox = xWs.OLEObjects("TempCombo")
        With xCombox
            .ListFillRange = ""
            .LinkedCell = ""
            .Visible = False
        End With
        If Target.Validation.Type = 3 Then
            Target.Validation.InCellDropdown = False
            Cancel = True
            xStr = Target.Validation.Formula1
            xStr = Right(xStr, Len(xStr) - 1)
            If xStr = "" Then Exit Sub
            With xCombox
                .Visible = True
                .Left = Target.Left
                .Top = Target.Top
                .Width = Target.Width + 5
                .Height = Target.Height + 5
                .ListFillRange = xStr
                If .ListFillRange = "" Then
                    xArr = Split(xStr, ",")
                    Me.TempCombo.List = xArr
                End If
                .LinkedCell = Target.Address
            End With
            xCombox.Activate
            Me.TempCombo.DropDown
        End If
    End Sub
    Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        Select Case KeyCode
            Case 9
                Application.ActiveCell.Offset(0, 1).Activate
            Case 13
                Application.ActiveCell.Offset(1, 0).Activate
        End Select
    End Sub
  3. ข่าวประชา อื่น ๆ + Q พร้อมกันเพื่อปิดไฟล์ แอปพลิเคชัน Microsoft Visual Basic หน้าต่าง

จากนี้ไปเมื่อคลิกที่เซลล์รายการแบบหล่นลงรายการแบบหล่นลงจะแจ้งโดยอัตโนมัติ คุณสามารถเริ่มพิมพ์ตัวอักษรเพื่อทำให้รายการที่เกี่ยวข้องเสร็จสมบูรณ์โดยอัตโนมัติในเซลล์ที่เลือก ดูภาพหน้าจอ:

หมายเหตุ รหัสนี้ใช้ไม่ได้กับเซลล์ที่ผสาน

ทำให้รายการแบบหล่นลงเติมข้อความอัตโนมัติได้อย่างง่ายดายใน 2 วินาที

สำหรับผู้ใช้ Excel ส่วนใหญ่ วิธี VBA ข้างต้นนั้นยากที่จะเชี่ยวชาญ แต่ด้วยความที่ รายการดรอปดาวน์ที่ค้นหาได้ คุณลักษณะของ Kutools สำหรับ Excelคุณสามารถเปิดใช้งานการเติมข้อความอัตโนมัติสำหรับรายการแบบหล่นลงของการตรวจสอบข้อมูลได้อย่างง่ายดายใน ช่วงที่ระบุ ในเวลาเพียง 2 วินาที ยิ่งไปกว่านั้น คุณลักษณะนี้ใช้ได้กับ Excel ทุกรุ่น

ปลาย: ก่อนใช้เครื่องมือนี้ โปรดติดตั้ง Kutools สำหรับ Excel ประการแรก ไปดาวน์โหลดฟรีเลย.

  1. หากต้องการเปิดใช้งานการเติมข้อความอัตโนมัติในรายการแบบเลื่อนลง ขั้นแรกให้เลือกช่วงที่มีรายการแบบเลื่อนลง จากนั้นนำทางไปยัง Kutools เลือกแท็บ รายการแบบหล่นลง > ทำให้รายการแบบหล่นลงสามารถค้นหาได้, ป๊อปอัปอัตโนมัติ.
  2. ตัว Vortex Indicator ได้ถูกนำเสนอลงในนิตยสาร ทำให้รายการแบบหล่นลงสามารถค้นหาได้ กล่องโต้ตอบ คลิก OK เพื่อบันทึกการตั้งค่า
ผล

เมื่อการกำหนดค่าเสร็จสมบูรณ์ การคลิกที่เซลล์รายการแบบเลื่อนลงภายในช่วงที่ระบุจะเป็นการเปิดกล่องรายการขึ้นมา เมื่อป้อนอักขระ ตราบใดที่รายการหนึ่งตรงกันทุกประการ ทั้งคำจะถูกไฮไลท์ในกล่องรายการทันที และสามารถเติมลงในเซลล์รายการแบบเลื่อนลงได้ง่ายๆ เพียงกดปุ่ม Enter

หมายเหตุ: หากต้องการใช้คุณสมบัตินี้ โปรด ดาวน์โหลดและติดตั้ง Kutools สำหรับ Excel อันดับแรก. หรือคุณสามารถ คลิกเพื่อทราบข้อมูลเพิ่มเติมเกี่ยวกับคุณลักษณะนี้.

บทความที่เกี่ยวข้อง:

วิธีสร้างรายการแบบหล่นลงพร้อมช่องทำเครื่องหมายหลายช่องใน Excel
ผู้ใช้ Excel จำนวนมากมักจะสร้างรายการแบบหล่นลงโดยมีช่องทำเครื่องหมายหลายช่องเพื่อเลือกหลายรายการจากรายการต่อครั้ง จริงๆแล้วคุณไม่สามารถสร้างรายการที่มีช่องทำเครื่องหมายหลายช่องด้วยการตรวจสอบข้อมูล ในบทช่วยสอนนี้เราจะแสดงวิธีการสองวิธีในการสร้างรายการแบบหล่นลงพร้อมช่องทำเครื่องหมายหลายช่องใน Excel บทแนะนำนี้มีวิธีการแก้ปัญหา

สร้างรายการแบบหล่นลงจากสมุดงานอื่นใน Excel
มันค่อนข้างง่ายในการสร้างรายการแบบเลื่อนลงสำหรับการตรวจสอบข้อมูลระหว่างแผ่นงานภายในสมุดงาน แต่ถ้าข้อมูลรายการที่คุณต้องการสำหรับการตรวจสอบข้อมูลอยู่ในสมุดงานอื่นคุณจะทำอย่างไร? ในบทช่วยสอนนี้คุณจะได้เรียนรู้วิธีสร้างรายการลดลงจากสมุดงานอื่นใน Excel โดยละเอียด

สร้างรายการดรอปดาวน์ที่ค้นหาได้ใน Excel
สำหรับรายการแบบหล่นลงที่มีค่ามากมายการค้นหารายการที่เหมาะสมไม่ใช่เรื่องง่าย ก่อนหน้านี้เราได้แนะนำวิธีการกรอกรายการแบบเลื่อนลงโดยอัตโนมัติเมื่อป้อนตัวอักษรตัวแรกลงในช่องแบบเลื่อนลง นอกจากฟังก์ชันเติมข้อความอัตโนมัติแล้วคุณยังสามารถค้นหารายการแบบหล่นลงได้เพื่อเพิ่มประสิทธิภาพในการทำงานในการค้นหาค่าที่เหมาะสมในรายการแบบเลื่อนลง หากต้องการค้นหารายการแบบหล่นลงให้ลองใช้วิธีการในบทช่วยสอนนี้

เติมข้อมูลเซลล์อื่นโดยอัตโนมัติเมื่อเลือกค่าในรายการแบบเลื่อนลงของ Excel
สมมติว่าคุณได้สร้างรายการแบบหล่นลงตามค่าในช่วงเซลล์ B8: B14 เมื่อคุณเลือกค่าใด ๆ ในรายการแบบหล่นลงคุณต้องการให้ค่าที่เกี่ยวข้องในช่วงเซลล์ C8: C14 ถูกเติมโดยอัตโนมัติในเซลล์ที่เลือก สำหรับการแก้ปัญหาวิธีการในบทช่วยสอนนี้จะช่วยคุณได้

บทแนะนำเพิ่มเติมสำหรับรายการแบบเลื่อนลง ...

สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

🤖 Kutools AI ผู้ช่วย: ปฏิวัติการวิเคราะห์ข้อมูลโดยยึดตาม: การดำเนินการที่ชาญฉลาด   |  สร้างรหัส  |  สร้างสูตรที่กำหนดเอง  |  วิเคราะห์ข้อมูลและสร้างแผนภูมิ  |  เรียกใช้ฟังก์ชัน Kutools...
คุณสมบัติยอดนิยม: ค้นหา เน้น หรือระบุรายการที่ซ้ำกัน   |  ลบแถวว่าง   |  รวมคอลัมน์หรือเซลล์โดยไม่สูญเสียข้อมูล   |   รอบโดยไม่มีสูตร ...
การค้นหาขั้นสูง: VLookup หลายเกณฑ์    VLookup หลายค่า  |   VLookup ข้ามหลายแผ่น   |   การค้นหาที่ไม่ชัดเจน ....
รายการแบบเลื่อนลงขั้นสูง: สร้างรายการแบบหล่นลงอย่างรวดเร็ว   |  รายการแบบหล่นลงขึ้นอยู่กับ   |  เลือกหลายรายการแบบหล่นลง ....
ผู้จัดการคอลัมน์: เพิ่มจำนวนคอลัมน์เฉพาะ  |  ย้ายคอลัมน์  |  สลับสถานะการมองเห็นของคอลัมน์ที่ซ่อนอยู่  |  เปรียบเทียบช่วงและคอลัมน์ ...
คุณสมบัติเด่น: กริดโฟกัส   |  มุมมองการออกแบบ   |   บาร์สูตรใหญ่    สมุดงานและตัวจัดการชีต   |  ห้องสมุดทรัพยากร (ข้อความอัตโนมัติ)   |  เลือกวันที่   |  รวมแผ่นงาน   |  เข้ารหัส/ถอดรหัสเซลล์    ส่งอีเมลตามรายการ   |  ซุปเปอร์ฟิลเตอร์   |   ตัวกรองพิเศษ (กรองตัวหนา/ตัวเอียง/ขีดทับ...) ...
ชุดเครื่องมือ 15 อันดับแรก12 ข้อความ เครื่องมือ (เพิ่มข้อความ, ลบอักขระ, ... )   |   50 + แผนภูมิ ประเภท (แผนภูมิ Gantt, ... )   |   40+ ใช้งานได้จริง สูตร (คำนวณอายุตามวันเกิด, ... )   |   19 การแทรก เครื่องมือ (ใส่ QR Code, แทรกรูปภาพจากเส้นทาง, ... )   |   12 การแปลง เครื่องมือ (ตัวเลขเป็นคำ, การแปลงสกุลเงิน, ... )   |   7 ผสานและแยก เครื่องมือ (แถวรวมขั้นสูง, แยกเซลล์, ... )   |   ... และอื่น ๆ

เพิ่มพูนทักษะ Excel ของคุณด้วย Kutools สำหรับ Excel และสัมผัสประสิทธิภาพอย่างที่ไม่เคยมีมาก่อน Kutools สำหรับ Excel เสนอคุณสมบัติขั้นสูงมากกว่า 300 รายการเพื่อเพิ่มประสิทธิภาพและประหยัดเวลา  คลิกที่นี่เพื่อรับคุณสมบัติที่คุณต้องการมากที่สุด...

รายละเอียด


แท็บ Office นำอินเทอร์เฟซแบบแท็บมาที่ Office และทำให้งานของคุณง่ายขึ้นมาก

  • เปิดใช้งานการแก้ไขและอ่านแบบแท็บใน Word, Excel, PowerPoint, ผู้จัดพิมพ์, Access, Visio และโครงการ
  • เปิดและสร้างเอกสารหลายรายการในแท็บใหม่ของหน้าต่างเดียวกันแทนที่จะเป็นในหน้าต่างใหม่
  • เพิ่มประสิทธิภาพการทำงานของคุณ 50% และลดการคลิกเมาส์หลายร้อยครั้งให้คุณทุกวัน!
Comments (325)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi, many thanks for this material. It helped a lot.
This comment was minimized by the moderator on the site
Hello,

following on from my last comment:

I'm setting up 'standard' rows with the dropdown lists in them. These I'm wanting to copy below into an extensive spreadsheet.
Unfortunately the dropdown's don't copy down when I do that after using the VBA.
Is there a way to do whats described above?

Cheers,
Catherine
This comment was minimized by the moderator on the site
Hi Catherine,
The autocomplete drop-down lists generated by VBA code cannot be copied. You can only copy selected items that are displayed in the drop-down cell. Sorry for the inconvenience.
This comment was minimized by the moderator on the site
Hello,

Have implemented this successfully, so thank you for this page and code.
But now I have an associated problem...:

After doing all of the above points, the code works as described, but I cannot do any undo/redo actions in the entire spreadsheet.
Is there a way to turn this combo box on for when I want to work with the dropdowns and off for when I want to work in other cells? so that the undo/redo actions are possible again?
and note, yes I have turned the design mode off after doing the above steps, but it still doesn't help the problem.

Cheers,
Catherine
This comment was minimized by the moderator on the site
Hi Catherine Foley,
If you want to use the undo operation on cells other than the drop-down cells, the following VBA code can help you. Please give it a try.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Update by Extendoffice: 2022/09/22
    Dim xCombox As OLEObject
    Dim xStr As String
    Dim xWs As Worksheet
    Dim xArr
    
    On Error Resume Next

    Set xWs = Application.ActiveSheet
    
    Set xCombox = xWs.OLEObjects("TempCombo")
    If Target.Validation.Type <> 3 Then
        If xCombox.Visible Then
            xCombox.Visible = False
        End If
        Exit Sub
    End If
    
    With xCombox
        .ListFillRange = ""
        .LinkedCell = ""
'        .Visible = False
    End With

    Target.Validation.InCellDropdown = False
    Cancel = True
    xStr = Target.Validation.Formula1
    xStr = Right(xStr, Len(xStr) - 1)
    If xStr = "" Then Exit Sub
    With xCombox
        .Visible = True
        .Left = Target.Left
        .Top = Target.Top
        .Width = Target.Width + 5
        .Height = Target.Height + 5
        .ListFillRange = xStr
        If .ListFillRange = "" Then
            xArr = Split(xStr, ",")
            Me.TempCombo.List = xArr
        End If
        .LinkedCell = Target.Address
    End With
    xCombox.Activate
    Me.TempCombo.DropDown

End Sub
Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    Select Case KeyCode
        Case 9
            Application.ActiveCell.Offset(0, 1).Activate
        Case 13
            Application.ActiveCell.Offset(1, 0).Activate
    End Select
End Sub
This comment was minimized by the moderator on the site
I hope now it will be upload
This comment was minimized by the moderator on the site
This code works really well for a single drop down. However, if I have 5 dropdowns using the same list of values but they need to operate independently of each other how is that accomplished? Despite my best efforts, if I put more than one combo box on the page, any selection is one is mirrored in the other.
This comment was minimized by the moderator on the site
Hi Mbuchmeier,Only need one combo box on the page. The code works on all drop-down lists in current page. You just need to manually click on the drop-down list cell to activate the combo box.
This comment was minimized by the moderator on the site
Hi crystal,
I am working with the combo box (The VBA code from 2021/11/05). It is working great and very useful but there are 2 issues:1. Issue #1: Usually when you work on any cell in Excel, there is indication on the row number which indicate which row you work about. When the combo box is opened this indication is missing2.  Issue #2: When the combo box is opened in the last column of the dynamic table, then it isn't  working as usual: when I select value from the list, the cell remain empty until I move the cursor to another cell
Attached screenshot.
Thank in advance
This comment was minimized by the moderator on the site
Hi Yoni,Thanks for your feedback. For the issues you mentioned:1. Issue #1: Excel does not highlight the row number when selecting an object in the worksheet. Since we use a combo box to replace the data validation drop-down list to handle the autocomplete operation, we can't show the indication in this case;2. Issue #2: I have tried as you described, but the problem cannot be reproduced. The screenshot you attached does not display, you need to save the screenshot and uplode it via the "Upload files" button below.
This comment was minimized by the moderator on the site
Hi Crystal,Thanks a lot for your response. Attached the screenshot. hope it will work now
This comment was minimized by the moderator on the site
Hi Yoni,Sorry for the inconvenience. The screenshot you uploaded is still not shown on the page. You need to save the screenshot on your disk in advance and then uplode it via the "Upload files" button. See the attached screenshot.
This comment was minimized by the moderator on the site
will, thank you is not enugh :::: alot of thank you then ;;;;; that worked like magic :)
This comment was minimized by the moderator on the site
Yeah, basically completely useless.  Want the cell to auto-complete when typing in a cell using list data validation.Tried this, and now I have to start over from scratch because I can't Undo it.  Thanks.Also loaded with syntax errors.
This comment was minimized by the moderator on the site
It works as it should be except for two things, first, there is no validation after insertion. i.e. if I typed anything at the combo then clicked enter it will accept the typed value while it should not do this since the data validation is being used to prevent such behaviors and make sure that the entered data is from selected range. Second, at the data validation list, sometimes I use big range with empty cells and select ignore empty at validation list but the combo takes all the range and shows it, will be nice to remove the empty cells from the combo range.
Thanks & hope you can implement these things to make it perfect.
This comment was minimized by the moderator on the site
Hi, AhmedThe VBA below helps to solve the problem of blank cells. Since the Combo box accepts the value that are not in the list, we still can't find a way to solve this problem. Sorry for the inconvenience.
<div data-tag="code">Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Update by Extendoffice: 2021/11/05
Dim xCombox As OLEObject
Dim xStr As String
Dim xWs As Worksheet
Dim xArr, xArr1
Dim xRg As Range
Dim xSrc As Variant
Dim xI, xJ, xIndex, xCount As Integer

Set xWs = Application.ActiveSheet
On Error Resume Next
Set xCombox = xWs.OLEObjects("TempCombo")
With xCombox
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
End With
If Target.Validation.Type = 3 Then
Target.Validation.InCellDropdown = False
Cancel = True
xStr = Target.Validation.Formula1
xStr = Right(xStr, Len(xStr) - 1)
If xStr = "" Then Exit Sub
Set xRg = Range(xStr)
If xRg Is Nothing Then
xArr1 = Split(xStr, ",")
Else
ReDim xArr1(0 To xRg.Count - 1)
For xI = 0 To xRg.Count - 1
xArr1(xI) = xRg.Item(xI + 1).Value
Next
End If
xI = 0
xCount = UBound(xArr1) + 1
For xJ = 0 To UBound(xArr1)
If Replace(xArr1(xJ), " ", "") = "" Then xCount = xCount - 1
Next
ReDim xArr(0 To xCount - 1)
xIndex = 0
For xJ = 0 To UBound(xArr1)
If Replace(xArr1(xJ), " ", "") <> "" Then
xArr(xIndex) = xArr1(xJ)
xIndex = xIndex + 1
End If
Next
xStr = ""
With xCombox
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 5
.Height = Target.Height + 5
.ListFillRange = xStr
If .ListFillRange = "" Then
'xArr = Split(xStr, ",")
Me.TempCombo.List = xArr
End If
.LinkedCell = Target.Address
End With
xCombox.Activate
Me.TempCombo.DropDown
End If
End Sub
Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
Case 9
Application.ActiveCell.Offset(0, 1).Activate
Case 13
Application.ActiveCell.Offset(1, 0).Activate
End Select
End Sub
This comment was minimized by the moderator on the site
Hi Crystal,
I am working with the combo box (The VBA code from 2021/11/05). It is working great and so useful! thanks a lot.
I found the source of my problem. There was a line of freeze panes which override the combo box.
The only problem now is that the Undo is not working. Any idea?
Thanks in advanced,
Yoni
This comment was minimized by the moderator on the site
Hi,
The code does not support Undo. Sorry for the inconvenience.
This comment was minimized by the moderator on the site
Thanks. Maybe do you know why Worksheet_Change event is not firing once I choose value from the combo box?
This comment was minimized by the moderator on the site
Hi, could you please doublecheck this code, when I use it instead of the dropdown list appearing, the source for the dropdown appears instead. This is the exact function I want, could you please fix it.
This comment was minimized by the moderator on the site
If you use a named range or something similar, like I have with a table column, it will display the named range name instead of the values in that named range. To get what you want, you need to change the xStr to display the worksheet range of that named range, since the .ListFillRange does not take in named ranges directly. This should accomplish it : dim RangeAddress as String: RangeAddress = Range(YourNamedRange).addressand then make the xStr something like this: xStr = "YourWorksheetNameWithTheNamedRangeInIt!" & RangeAddress (important: add the '!' for the sheet reference)
This will make your xStr look something like: NamedRangeSheet!$A$1:$A$5
xStr = Right(xStr, Len(xStr) - 1)

If .ListFillRange = "" Then
xArr = Split(xStr, ",")
Me.TempCombo.List = xArr
End If

with these adjustments your combobox should display the list values instead of the source
This comment was minimized by the moderator on the site
Hi Syu,Sorry I don't quite understand your description. Can you try to be more specific of it?After applying the VBA code mentioned in the above method, when the cell with the data validation drop-down list is checked, the drop-down list turn into a combo box, and then all the items in the list are listed. 
This comment was minimized by the moderator on the site
do you have an example file please?
This comment was minimized by the moderator on the site
Hello. The code is very cool. Please make sure that the formula "INDIRECT" is carried out and displayed. It is very necessary
This comment was minimized by the moderator on the site
The code is not working for a validation list which is created by vba code and the source is a named range
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