+ Reply to Thread
Results 1 to 6 of 6

Dynamic Combobox List Won't show Any List (Adapt from Contextures) Help!

Hybrid View

  1. #1
    Registered User
    Join Date
    11-12-2015
    Location
    Surabaya, Indonesia
    MS-Off Ver
    MS 365 (Windows 11 64-bit)
    Posts
    84

    Dynamic Combobox List Won't show Any List (Adapt from Contextures) Help!

    Linkback : http://www.mrexcel.com/forum/excel-q...ures-help.html

    Hi All,

    I have encounter an error (result in blank combobox list), while using dynamic data validation list, and adapt it to combobox list. it only works for only common data validation list.

    the list placed on different sheet :
    FORUM2.JPG

    for the dynamic data validation list, I'm using formula :
    Formula: copy to clipboard
    =INDIRECT(VLOOKUP(B3,Named_Range,2,FALSE))


    the combobox result an empty
    FORUM3.JPG

    My excel file is here :


    My code is :
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    
    Dim str As String
    Dim cboTemp As OLEObject
    Dim ws As Worksheet
    
    Set ws = ActiveSheet
    On Error GoTo errHandler
    
    
        Set cboTemp = ws.OLEObjects("ComboBox1")
          On Error Resume Next
          With cboTemp
            .ListFillRange = ""
            .LinkedCell = ""
            .Visible = False
          End With
    
    
        On Error GoTo errHandler
          If Target.Validation.Type = 3 Then
            Cancel = True
            Application.EnableEvents = False
            str = Target.Validation.Formula1
            str = Right(str, Len(str) - 1)
            With cboTemp
              .Visible = True
              .Left = Target.Left
              .Top = Target.Top
              .Width = Target.Width + 15
              .Height = Target.Height + 5
              .ListFillRange = str
              .LinkedCell = Target.Address
            End With
            cboTemp.Activate
            'open the drop down list automatically
            Me.ComboBox1.DropDown
          End If
    
    
    errHandler:
      Application.EnableEvents = True
      Exit Sub
    
    
    End Sub
    the link source for
    combo box list :
    http://www.contextures.com/xlDataVal...Combo#AddCombo

    dynamic data validation list :
    http://www.contextures.com/xlDataVal02.html

    thanks a lot for the help,
    Warm regards

    Adrian
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Dynamic Combobox List Won't show Any List (Adapt from Contextures) Help!

    Seems to work fine for me?
    If someone has helped you then please add to their Reputation

  3. #3
    Registered User
    Join Date
    11-12-2015
    Location
    Surabaya, Indonesia
    MS-Off Ver
    MS 365 (Windows 11 64-bit)
    Posts
    84

    Re: Dynamic Combobox List Won't show Any List (Adapt from Contextures) Help!

    Hi whitfield,

    in my excel, the combobox result empty list. how come?

  4. #4
    Registered User
    Join Date
    11-12-2015
    Location
    Surabaya, Indonesia
    MS-Off Ver
    MS 365 (Windows 11 64-bit)
    Posts
    84

    Re: Dynamic Combobox List Won't show Any List (Adapt from Contextures) Help!

    Solved... Just need a simple modification on the code, no additional code at all.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Dynamic Combobox List Won't show Any List (Adapt from Contextures) Help!

    Hi raidian89

    Please post your solution for our edification.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Registered User
    Join Date
    11-12-2015
    Location
    Surabaya, Indonesia
    MS-Off Ver
    MS 365 (Windows 11 64-bit)
    Posts
    84

    Re: Dynamic Combobox List Won't show Any List (Adapt from Contextures) Help!

    whoops...

    here's the code

    If Not Intersect(Target, Target.Worksheet.Range("C:C")) Is Nothing Then
        Set cboTemp = ws.OLEObjects("ComboBox1")
    '      On Error Resume Next
          With cboTemp
            .ListFillRange = ""
            .LinkedCell = ""
            .Visible = False
          End With
    
    '    On Error GoTo errHandler
          If Target.Validation.Type = 3 Then
            Cancel = True
            Application.EnableEvents = False
            str = Cells(Target.Row, 2).Value
            str = Right(str, Len(str))
            With cboTemp
              .Visible = True
              .Left = Target.Left
              .Top = Target.Top
              .Width = Target.Width + 15
              .Height = Target.Height + 5
              .ListFillRange = str
              .LinkedCell = Target.Address
            End With
            cboTemp.Activate
            'open the drop down list automatically
            Me.ComboBox1.DropDown
          End If
    End If

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] ComboBox Show Non Repeat List
    By oskar44 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 07-11-2015, 08:46 PM
  2. [SOLVED] Dynamic folder list in Combobox
    By RaydenUK in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-27-2015, 02:03 PM
  3. filling a combobox with a dynamic list
    By Ascopeland in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2012, 09:56 PM
  4. NON Dynamic ComboBox list
    By GaidenFocus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2012, 12:30 PM
  5. Dynamic List for combobox
    By T De Villiers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-15-2008, 05:49 AM
  6. [SOLVED] How do I set the rowsource for a ComboBox for a dynamic list?
    By ndm berry in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-29-2005, 09:05 AM
  7. Combobox with a dynamic list
    By Arishy in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-12-2005, 10:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1