+ Reply to Thread
Results 1 to 10 of 10

SQL List to Combo Box on spreadsheet on Open

  1. #1
    Registered User
    Join Date
    11-26-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    95

    Lightbulb SQL List to Combo Box on spreadsheet on Open

    I have this working on a userform. However I need to get this to work on a Spreadsheet using the Form Controls Combo Box.

    When the Workbook opens I want the Combo box to automatically contain the list of Portfolios I want to use. I have tweaked this code a bit from the one I use on the Userform. However I can't get it to work.


    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: SQL List to Combo Box on spreadsheet on Open

    Not sure you can do what you want with a Forms combobox, have you tried an ActiveX one?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-26-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    95

    Re: SQL List to Combo Box on spreadsheet on Open

    I had a look. Couldnt get that working either. If you know of anyway of populating any Combo drop down with VBA could would be helpful.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: SQL List to Combo Box on spreadsheet on Open

    What happens when you try it with a forms control? If you can't use additem, use the list property. I don't see why Norie thinks it's not possible - maybe I've missed something.

  5. #5
    Registered User
    Join Date
    11-26-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    95

    Re: SQL List to Combo Box on spreadsheet on Open

    I get the error. Wrong Number of Arguments or invalid property assignment.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: SQL List to Combo Box on spreadsheet on Open

    Untested.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: SQL List to Combo Box on spreadsheet on Open

    Hi,

    Perhaps this
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: SQL List to Combo Box on spreadsheet on Open

    Kyle123

    I mistakenly thought the OP was trying to populate a 2 column combobox because of the use of AddItem followed by List.

    However when I look at the code I see that's not the case.

    Perhaps all they need is this.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-26-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    95

    Re: SQL List to Combo Box on spreadsheet on Open

    Perfect. Thank you all. I have it working.

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: SQL List to Combo Box on spreadsheet on Open

    Thanks for rep+.

    Maybe you can share your solution for future viewers of this thread. TY

+ 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. Outlook Form - list OPen Excel Workbooks in drop down combo box
    By Viper010 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 05-24-2016, 12:12 PM
  2. combo box displays values from a list drawn from spreadsheet
    By lifeseeker1019 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2014, 01:26 AM
  3. Replies: 0
    Last Post: 07-25-2012, 02:54 PM
  4. Open a document from a Combo Box drop down list with a Command Button.
    By Ortz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2012, 02:34 PM
  5. Copy Combo Box list to spreadsheet
    By BJ5352 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2011, 07:59 PM
  6. Combo Box Userform To Open 2nd Combo Box
    By WPJensen in forum Excel General
    Replies: 8
    Last Post: 03-10-2011, 06:33 AM
  7. Filtered list for Combo Box ListFillRange - Nested Combo Boxes
    By DoctorG in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2006, 08:20 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