+ Reply to Thread
Results 1 to 3 of 3

Large Form Help: Handling large number of text boxes and labels

  1. #1
    Registered User
    Join Date
    07-24-2008
    Location
    Dallas
    Posts
    17

    Large Form Help: Handling large number of text boxes and labels

    I could use some advice on getting a large form do to what I want it to.

    My goal is to use a single form that users can input data into, and all of the data will be stored in the excel spreadsheet the form is attached to. Here is the basic idea: I have dozens of positions, and for each position, I need to allocate their time across 25 different activities. I am working on building a form where the user can define a list of positions, and then select them from a dropdown, and then put in the activity-specific allocation into text boxes for each of the 25 activities. From here, the user will hit save, and all the data for that position will be sent to excel. Also, the user can select a previously saved position and see how the position was allocated.

    Question 1: What is the best way to save data from 25 different text boxes on a form to a spreadsheet in excel. Doing something like Application.range("allocations")(1,1) . value = txt_name.value takes FOREVER to repeat for each and every text box. Is there a better way? I tried looping, but it didn't work. I cant even get the txtboxname.value to work. Do I need to set txtboxname = control or something like that? Can I loop through each control in a frame and then reference the name and use that to place it in the correct location in the spreadsheet?

    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,258

    Re: Large Form Help: Handling large number of text boxes and labels

    Hello laterdaysluke,

    You were close. See the bold line for the correction.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Large Form Help: Handling large number of text boxes and labels

    Here is a method of moving data from form controls to specified cells on an excel worksheet. I have used the control's "tag" field to provide a row number where the data is to be placed. If you look at the definition of the textboxes on Userform1 you will see what I mean.

    The processing is in the Commandbutton1 Click event handler. It would be elsewhere if so desired.

    I am looping through all of the controls at the form level. If you need to loop through controls within a frame, then change the loop upper bounds to Me.Controls("Framename").Controls

    HandleTextboxes.xls
    Bob
    Click my star if my answer helped you. Mark the thread as [SOLVED] if it has been.

+ 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