+ Reply to Thread
Results 1 to 14 of 14

Command Button to update the multiple line items in a TextBox

  1. #1
    Registered User
    Join Date
    07-01-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    66

    Command Button to update the multiple line items in a TextBox

    I have created a Userform and after updating details in the form, on clicking OK (command button) i want the user form to populate the details in a Textbox.

    However, there will be multiple lines that i would want to update in the text box. So after clicking OK once, the text box would be updated. Then i would fill in different details in the form and after clicking OK again, another line would get created in the same text box.

    Can someone please help.

    This is my current OK button Code.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    10-14-2013
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2003, 2013
    Posts
    25

    Re: Command Button to update the multiple line items in a TextBox

    if you are trying to add a new line the text box each time (assuming you are in the userform) try:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-01-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Command Button to update the multiple line items in a TextBox

    I have attached my file. I want the data that i fill in the form like COB date, Client NAme, Rec Owner Name etc to be updated in different lines in the Commentary Textbox.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-14-2013
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2003, 2013
    Posts
    25

    Re: Command Button to update the multiple line items in a TextBox

    Can you provide a sample of what you would want the textbox output to look like and what lines would get updated. It might be simpler to just re-input the entire contents of the textbox each time if it just 4 lines

  5. #5
    Registered User
    Join Date
    07-01-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Command Button to update the multiple line items in a TextBox

    Below is a sample for the output. These should be a set of details. One Question here is that, can the labels highlighted in Bold also get updated as a Header in the output textbox

    COB Date: 10/14/2013
    Client Name: BNP – 33417
    Rec Owner Name: Aaron
    Disputed Amount: 1,000,000



    I would be later adding more textboxes in the form so that the Output Textbox gets updated on the click of the command button.

  6. #6
    Registered User
    Join Date
    10-14-2013
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2003, 2013
    Posts
    25

    Re: Command Button to update the multiple line items in a TextBox

    You might be better off using a listbox, that way you can output multiple columns and rows and easily change any item.

  7. #7
    Registered User
    Join Date
    07-01-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Command Button to update the multiple line items in a TextBox

    How would that be possible. I'm sorry, I'm quite an amateur in VBA and still learning alot.

  8. #8
    Registered User
    Join Date
    07-01-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Command Button to update the multiple line items in a TextBox

    I'm sorry for not being clear enough. I have attached the file as to how my form should look like. I have also attached a .jpg file for the flow. Please help me. Thanks for your help.

    Picture1.jpg
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-14-2013
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2003, 2013
    Posts
    25

    Re: Command Button to update the multiple line items in a TextBox

    No worries, i have given two solutions in the attached file, a listbox with 6 columns or the textbox method. You could use a combination and have a listbox with 2 columns displaying the same output as the textbox method, it depends on how you want the form to display. Currently both methods are active, just delete the one you don't want

    Dispute Commentary - Updated.xls

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: Command Button to update the multiple line items in a TextBox

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Cross Posted to: http://www.excelfox.com/forum/f2/com...-textbox-1518/

    Please read this: http://www.excelguru.ca/content.php?184
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  11. #11
    Registered User
    Join Date
    07-01-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Command Button to update the multiple line items in a TextBox

    Hi Alan - Thanks for shedding light on the cross posting rules. Does make sense not to duplicate someone's work.


    Hi Nigel - I have a question. I am adding the textbox2 (Reason for Dispute) and textbox3 (Miscellaneous Comments)codes to the commandbutton click. but it gives me the below error. Here is my code

    Please Login or Register  to view this content.
    Compile error "wrong number of arguments or invalid property assignment"

    Also, i want to understand the codes for ExportContents and OutputTextbox that you have used.

    Thanks for your help once again.

  12. #12
    Registered User
    Join Date
    10-14-2013
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2003, 2013
    Posts
    25

    Re: Command Button to update the multiple line items in a TextBox

    you will have to remove the last two arguments from that call (the two "") they were just placeholders I made for the textbox2 and textbox3 values.

  13. #13
    Registered User
    Join Date
    07-01-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Command Button to update the multiple line items in a TextBox

    Hi Nigel - Thanks. Now i have created the exact form as per my requirement by adding more text boxes. Needed your few help over little items which should be an easy go considering your expertise.

    1) When I click 'To Commentary' multiple times adding more data, there are blank rows created in the Commentary Box when i dont update a particular textbox. Is it possible for the data to be entered in the next line itself instead of creating blank rows.

    2) On the userform, can there be static data, that can be a part of the output in the Commentary Box? For e.g. 'MO/Contact Query Riased', can this be a part of the data. I would need to add some more textboxes/label to complete the userform.

    3) I'm not sure i would require the codes for ExportContents and Output Textbox. You would know better though.

    4) Lastly, by clicking the TAB button on the keyboard, is it possible for the cursor to move as per the textboxes as per my requirement just to make the form userfriendly.

    I have attached my file and a sample desired output in excel as to how i would want it to be. Please help.
    Thanks once again.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    10-14-2013
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2003, 2013
    Posts
    25

    Re: Command Button to update the multiple line items in a TextBox

    1) Yes, just check if the value has been entered in the textbox, if it has then add it to the commentary box eg:

    Please Login or Register  to view this content.
    2)Yes, add the static data as you would any other textbox (or output to the spreadsheet as currently with the other textboxes)

    3)You seem to have commented out all the added code so I am unsure of how you are doing it and hence what you will need. If your code does not call the function you will not need it (if in doubt, comment out the function first and test it)

    4)Yes, select the textbox, in the properties section you will see a property called 'TabIndex', change this for all the textboxes to the order you want

    Hope this helps

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. pass multiple items to a command line
    By marcwords in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2013, 03:30 PM
  2. Automatically update existing data using a Update command button
    By 9999335 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 09:46 PM
  3. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  4. for loop with textbox and command button
    By st0kvis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2011, 04:33 AM
  5. Adding a textbox via command button
    By NewExcelUser in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-22-2006, 12:49 PM

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