+ Reply to Thread
Results 1 to 5 of 5

Populating a UserForm

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Populating a UserForm

    Dear Forum Members,
    I need to be able to populate the controls in a userform from the values of the controls of a second userform.
    I have used code like
    Please Login or Register  to view this content.
    The problem is that there are 16 textboxes and other controls on the forms and I am sure that there is a more elegant way of coding this .
    Can anyone give me a suggestion please?
    John
    Last edited by j_Southern; 03-18-2011 at 11:42 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Populating a UserForm

    Hi,
    The answer is you need to use the index number of the controls on your userform in a loop.

    Look at http://spreadsheetpage.com/index.php/tip/C29 and search down for:
    Handle Multiple Userform Buttons With One Subroutine
    to see an example of indexing.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

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

    Re: Populating a UserForm

    Why two UserForms? Is it really necessary?

    See this example, each user form has two textboxes tb1 & tb2
    Attached Files Attached Files
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Populating a UserForm

    Thanks for your help. I think I will be able to take it further now.
    The two forms are connected with order entry. One accepts a new job name into a text box and is populated manualy. the other enables a search of existing job names and is populated by the program from data in the file of the existing job.
    Sometimes an existing job needs a modification and in this case it is useful to populate the userform programaticaly and make modifications. This is where one form needs populating from the other form
    John

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

    Re: Populating a UserForm

    Without seeing an example of the data i would have thought one Userform should be enough.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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