+ Reply to Thread
Results 1 to 2 of 2

VBA programming help with userforms and comboboxes

  1. #1
    Registered User
    Join Date
    07-13-2011
    Location
    Connecticut, USA
    MS-Off Ver
    Excel 2003
    Posts
    13

    VBA programming help with userforms and comboboxes

    Hello,
    This is my first time to this forum and first time programming vba, what I need to do is simple in theory but is proving to be difficult. I have just a couple little problems and if you can help with one or any please do, any suggestion would be greatly appreciated.

    With that said I am trying to create a user interface with a database behind it. The user starts the program and has 3 options to pick from, type, beam, and load. These are 3 comboboxes with drop down lists to pick from and everything works fine because they are pre determined ranges.
    When the user clicks next it brings them to a second userform with 2 more options, force and measurement, this is where I am having problems. Based on the beam and load type the user selects for the first one, their options for the first combobox should change.
    Example: If the user selects beam 1b for the beam combobox then the program should select sheet 1b. If the user then selects shear for the load combobox in that sheet it should select a specific range. Then on the next userform it should display the that range under the force combobox.

    I was trying to do this by setting them as global variables and having if statements to set them accordingly (you can look at the code for that) but it isnt working really Im not sure why, Idk if the variables carry over to the second userform?


    The second problem I have is that when the user picks one of the options from the [B]force[B] I want it to actually go to the range that it gives the options from and find the value the user picks, to then be able to offset the selected cell to the right and give an according value. However when I try and use the statement:

    Please Login or Register  to view this content.
    to accomplish that it gives the error: 'Run-time error '1004': Select method of Range class failed'

    Also I have just picked an abritrary sheet and range so that I can test it, that is where the sheet and range from the first userform should go. With that when I put a named range in where 'B1' is I get another error but I think its because its selecting the whole range, not just the first cell, how would I have it select the first cell in that range so that it can look through the range cell by cell accordingly to find the value.

    Sorry for writing so much but it warranted some explaination, please let me know if you can help

    First Userform code:
    Please Login or Register  to view this content.

    Second Userform Code:
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 07-13-2011 at 12:53 PM. Reason: Added Code Tags

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

    Re: VBA programming help with userforms and comboboxes

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Hope that helps.

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

    Free DataBaseForm example

+ 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