+ Reply to Thread
Results 1 to 7 of 7

Partially Populating a form with a command button

  1. #1
    Registered User
    Join Date
    10-10-2007
    Posts
    22

    Partially Populating a form with a command button

    Hello this is my first post to the forum and I am very new to VB. I have created a scheduling program that has 21 booking slots. I have a command button in each of these 21 slots that when clicked initializes a form. The code for this was easy, However what I would like to do is when I click the command button the form initializes and populates itself with the values of two cells, say for example a date from “B8” and a scenario from “C28”. I was able to get the form to populate itself when it initialized by placing the code into Initialize form area, but this only allows me the same value for all 21 slots, I require it to populate itself with 21 different sets of values depending on the button I click. In simple terms I want each of my buttons to (partially) populate the form depending on the booking slot I select. One other tidbit of info: the sheet with the info that populates the form is a worksheet called “SCHEDULING”.

    this is the code I tried to use to get the button to partially populate the form (but it didn’t work):

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Glenness,

    Is CommandButton3 on the UserForm Scheduler?

    Thanks,
    Leith Ross

  3. #3
    Registered User
    Join Date
    10-10-2007
    Posts
    22
    Hi Leith,
    Command button 3 is located on the worksheet called "SCHEDULING". It is not on the userform "scheduler". My plan is if I can get this command button to work I will create 21 of these. 1 in each scheduling slot. Thank for replying.
    Glenness

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Glenness,

    I will be busy for a few hours, and will get back on your problem when I am done. Now I have a better idea of what you want.

    Thanks,
    Leith Ross

  5. #5
    Registered User
    Join Date
    10-10-2007
    Posts
    22
    Hi again Leith,
    no rush ...appreciate your time. I can upload a sample if you wish.
    Glenness

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Glenness,

    The first thing you need to do to make this work is set the UserForm's ShowModal property to False. This enables switching input from the UserForm back to the Woksheet. Here is a code example for a button. The button calls a UserForm and then sets the text of the TextBox to the value in Range "E1". I tested this using several buttons with no problems. Change the object names to match what you are using.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  7. #7
    Registered User
    Join Date
    10-10-2007
    Posts
    22
    Thank you so much Leith! I am looking forward to trying this when I get home from work today!
    Glenness

    Works great! Thank you every so much!
    G
    Last edited by glenness; 10-11-2007 at 11:29 AM.

+ 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