+ Reply to Thread
Results 1 to 10 of 10

One TextBox containing the chosen results of multiple TextBoxes

  1. #1
    Registered User
    Join Date
    10-20-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    7

    Question One TextBox containing the chosen results of multiple TextBoxes

    Please help.

    I’m fairly new to VB (using Excel 2007) and I’m pulling the rest of my hair out with this one. I keep trying but keep failing which makes me think it’s not possible (probably that I’ve still a lot to learn about VB).

    Top level summary:

    A user answers a series of questions and each question corresponds to a predefined textual answer. Upon each question being answered a single TextBox gets populated with the combined textual answers.

    Some specifics:

    I want to be able to populate a single TextBox1 (in Sheet 3) with text from a series of already populated TextBoxes (4 TextBoxes per question) in Sheet 2. The plan is that the user answers a series of questions from a value (ranging from 1 to 4) in each question (Sheet 1) and each chosen value (1,2,3,4) is lodged in locations i5 to i60 on Sheet 1 and whichever values the user has chosen corresponds to a series of already populated TextBoxes (each question has four answers). As the user progresses through each question (all 55 questions) I need the textual answers (from already populated and formatted TextBoxes in Sheet 2) to be displayed (keeping their original formatting) in TextBox 1 (in Sheet 3) so I end up with one TextBox containing all of the textual answers that the user has chosen automatically. I hope that makes sense.

    Re-worded version of above:
    • Sheet 1 contains; 55 questions whereby the user chooses 1 of 4 (multiple choice answers) of each question and the answer (1 or 2 or 3 or 4) is populated in Sheet 1 Cell’s i5 to i60.
    • Sheet 2 contains; 55 rows of TextBoxes. Each row contains 4 TextBoxes. These TextBoxes contain 4 possible answers to each question in Sheet 1. Each TextBox is populated with formatted text.
    • Sheet 3 contains; 1 TextBox with the merged/ populated answers (from Sheet 2) from all the questions chosen in Sheet 1.

    Please help!

  2. #2
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: One TextBox containing the chosen results of multiple TextBoxes

    attach your workbook please - this will make it a lot easier to help you.
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

  3. #3
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: One TextBox containing the chosen results of multiple TextBoxes

    Well it is certainly challenging, and that's because the formatting in atext box isn't (so far as I know) readily copied excpet in another text box.
    The elements of a possible but long solution as specified include these elements:

    Each Textbox is a Shape on a sheet amd can be identified by name, e.g.
    Please Login or Register  to view this content.
    They could also be identified by index; ActiveSheet.Shapes(index) once you knew the index and could be sure it would not change as you edit the worksheet.
    Next you need to understand for the formatting is done. I recorded this with font name and size and color as a sample of what's involved.

    Please Login or Register  to view this content.
    In theory one could parse and record the stored text for repeating in the target box, but I would look for a different approach. Sorry!
    If you do manage it, the code would be worth sharing here.
    Last edited by brynbaker; 10-26-2012 at 01:47 PM. Reason: Added code tags

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: One TextBox containing the chosen results of multiple TextBoxes

    @ brynbaker

    Please notice that [CODE] tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at the top of the page and read Rule #3.
    Thanks.

  5. #5
    Registered User
    Join Date
    10-20-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: One TextBox containing the chosen results of multiple TextBoxes

    Hi. As requested I've now uploaded the file.

  6. #6
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: One TextBox containing the chosen results of multiple TextBoxes

    Thanks for that. It shows me that it's NOT the formatting you are interested in.
    Are you expecting your users to read the questions on Sheet2 and answer on Sheet1? Surely not, but if so, I would strongly recomend a cleaner UI and the coding could then be very much easier.

  7. #7
    Registered User
    Join Date
    10-20-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: One TextBox containing the chosen results of multiple TextBoxes

    Hi brynbaker. This is driving me mad so your help is much appreciated.
    The user will only 'see' Sheet 1. So, Sheet 2 and Sheet 3 will be hidden from them.
    The user will answer the questions within Sheet 1 and a user 'score' number (1 to 4) will be generated for each question they answer within Sheet 1.
    I then want Sheet 2 to see take the scores (from Sheet 1) and populate the TextBox (in Sheet 3) with the score related TextBoxes (Sheet 2).
    So, lets say the user answers question 1 by scoring 2. The TextBox (in Sheet 3) would see this score and drag across Question 1, Answer 2 (from Sheet 2).
    Hope that makes sense!

  8. #8
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: One TextBox containing the chosen results of multiple TextBoxes

    Thanks for the update. Tonight I don't have any version of Excel so this is a holding reply.
    When I looked at the sample file before I could not see how the questions (sitting in Sheet 2) could be seen in Sheet 1.
    Last edited by brynbaker; 10-26-2012 at 01:46 PM.

  9. #9
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: One TextBox containing the chosen results of multiple TextBoxes

    Very interesting. My very secure PC won't download your file; something in the link makes it expect PHP when it's xlsm so I can't help here.

  10. #10
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: One TextBox containing the chosen results of multiple TextBoxes

    I've researched again and found the VBA code for handling textboxes. It is a popular currect request.
    Here is a generic example that should help.
    Please Login or Register  to view this content.
    This should collect all the text values and store them in the bag collection for you.
    You could collect them in several different ways, inclding directly into the other textbox.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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