+ Reply to Thread
Results 1 to 15 of 15

Problem - ComboBox Population

  1. #1
    Registered User
    Join Date
    02-05-2008
    Posts
    8

    Problem - ComboBox Population

    I'm using the following code to populate a Combobox.

    When i click the dropdown list the numbers 1 to 8 are displayed, however when i click on an option nothing is selected and the combobox remains blank ?

    Can anyone help?

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    02-05-2008
    Posts
    8

    ComboBox Problem

    I'm trying to populate a combobox. I have to have dynamic options where the combobox updates evertime i click into it. I have the following example. The numbers are displayed in the list, however when i make a selection the combobox remains blank. can anyone help me ?

    Thank you

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475
    Hello,
    Try this
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    Move your code in Userform Initialize event, for example:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I'm not sure what you are doing. The code merely adds digits 1 to 8 into the ComboBox when you click the drop down button. There's nothing Dynamic. The code works fine for me, maybe it is not what you are expecting.

    If you place a value between 1 & 8 in A1 then the Combobox will change each time you click based on the value in A1.
    Please Login or Register  to view this content.
    Last edited by royUK; 02-05-2008 at 09:25 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    02-05-2008
    Posts
    8
    Hi Roy,

    Thanks,

    When i use the code the numbers are displayed in the combobox, but if i select a number the combobox doesnt update and display the select value...?

  7. #7
    Registered User
    Join Date
    02-05-2008
    Posts
    8
    Thanks Antonio,

    the problem here is that if a change the code, i have to run the whole macro to update the combobox, and as i have so many comboboxes which are going to be linked i need them to update.

    As you can proabaly tell i'm a bit of a newbie so any help is aprreciated.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I'm still not clear what you need. I can see no purpose for your code, what are you trying to do?

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why the duplicate post?

    I have merged the two threads

  10. #10
    Registered User
    Join Date
    02-05-2008
    Posts
    8

    Reply Roy Uk

    I'm develpoing an Excel model that evaluates cashflows from a CDO

    I'm trying to use cascading comboboxes to delvier the inputs to the model. There are around 40 comboboxes on the page.

    This combobox inparticular defines how many elements or 'tranches' are in the portfolio. Which will inturn switch other comboboxes on or off. (which i also have no knowledge of how to do).

    at the moment it lists 1 to 8 in the combobox, but doesnt actually display a number when one is selected. Perhaps there is an incorrect setting on my spreadsheet?

  11. #11
    Registered User
    Join Date
    02-05-2008
    Posts
    8
    Thanks Dave, that works.

    Sorry about the double post, a mistake.

    I'm still confused about why my code didn't do it.

    As far as cascading comboboxes is concerned in VBA, how can i switch off other cells and comboboxes dependant on the selcetion of another?

    Much appreciated.

    Daniel

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    As I said your code does nothing except populate the ComboBox, Dav'es writes to A1

  13. #13
    Registered User
    Join Date
    02-05-2008
    Posts
    8
    Thanks


    sorry to waste your time

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You aren't wasting time, I've just realised what was causing your problem - it was the line
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    02-05-2008
    Posts
    8
    Cheers,

    If you don't mind me asking you a couple more questions?

    At the moment my code looks like this ( i will do an 'if' statement for each case, but omitting it to keep it brief)

    Where i have placed the question marks i want ot input some code that 'switches off' a range of cells and some adjacent comboboxes so that the user is directed to input values only in the applicable fields. I know how to select a range, but how do i lock the cells ? is the lock funtion the most appriate method perhaps combined with some shading ?

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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