+ Reply to Thread
Results 1 to 8 of 8

UserForm ComboBox linked values

  1. #1
    Forum Contributor
    Join Date
    04-04-2014
    Location
    Tetbury, England
    MS-Off Ver
    Excel 2010
    Posts
    254

    UserForm ComboBox linked values

    Hello

    This is probably quite simple but I can't quite get mine to work.

    I have a userform which at the moment has 2 comboboxes (soon to be 3 once I sort this code). The second box will be determined upon the selection of the first.

    The first combobox currently equals a cell reference by way of 'RowSource': PLHeading1

    This being: Turnover, Direct Costs and Overheads


    When one is selected I would like a list of other names to appear in combobox 2

    Here is my code:

    Please Login or Register  to view this content.
    Could someone explain why this doesn't work?

    For reference, B4:B6 = cell reference PLTurnover2 B7:B11 = PLDirectCosts2 B12:B28 = PLOverheads2

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: UserForm ComboBox linked values

    Hi

    same like define name for respective heading values then replace your code with below one
    Please Login or Register  to view this content.
    attached for your reference.
    Attached Files Attached Files
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Forum Contributor
    Join Date
    04-04-2014
    Location
    Tetbury, England
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: UserForm ComboBox linked values

    Works perfectly thanks!

    Also, is it possible for the value of a combobox to equal a cell?

    For example, combobox1 could equal "Turnover" but elsewhere in the workbook the user can change the name of this if they like, so what if they change it to "Sales"?

    Combobox1 value = worksheet "Account Names" cell A5

    Thanks

  4. #4
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: UserForm ComboBox linked values

    if you provide a sample workbook so that i can create define name in VBA itself

    if anyone want to change define name they can change at VBA Script

  5. #5
    Forum Contributor
    Join Date
    04-04-2014
    Location
    Tetbury, England
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: UserForm ComboBox linked values

    Or could the value of combobox 1 equal the cell reference e.g. combobox 1 = "Heading" and so within "Heading" you have your Turnover, Direct Costs and Overheads, all of which can change name via another sheet.

    I think this would be far more efficient?

  6. #6
    Forum Contributor
    Join Date
    04-04-2014
    Location
    Tetbury, England
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: UserForm ComboBox linked values

    I just realised it can't equal a cell reference because the combobox will only have values from that cell reference, therefore the following combobox wouldn't know what values to input into the drop down.

    I think making it equal a cell itself is the best option

  7. #7
    Forum Contributor
    Join Date
    04-04-2014
    Location
    Tetbury, England
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: UserForm ComboBox linked values

    I got it working like this, which if the heading names change, the userform still works:

    Please Login or Register  to view this content.

    Thanks for your help! Rep given.

  8. #8
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: UserForm ComboBox linked values

    Glad i could help you

    1. If the suggestion helps you, then Click * to Add Reputation and mention your comments
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

+ 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] Userform combobox to populate RowSource for new values in combobox
    By Stratfordoaks in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-17-2013, 01:18 PM
  2. Userform: Unique Values to ComboBox
    By dinosaur1993 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-21-2013, 03:09 AM
  3. [SOLVED] Changed userform combobox to listbox, unable to get userform to retrieve datasheet values
    By dragonabsurdum in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2013, 01:38 PM
  4. [SOLVED] Validating values in a userform combobox.
    By Aorusakwe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2013, 11:52 AM
  5. Refresh UserForm to display data that is linked to combobox selection
    By alter54 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-16-2012, 01:30 PM

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