Page 1 of 2 12 LastLast
Results 1 to 10 of 11

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

  1. #1
    Member
    Join Date
    Jul 2013
    Posts
    31
    Rep Power
    0

    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.

    Code:
    Private Sub OKButton_Click()
    
    Dim emptyRow As Long
    
    'Make Sheet1 Active
    Sheets(1).Activate
    
    'Determine EmptyRow
    emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
    
    'Export Data to worksheet
    Cells(emptyRow, 1).Value = COB_Date.Value
    Cells(emptyRow, 2).Value = Client_Name.Value
    Cells(emptyRow, 3).Value = NameTextBox.Value
    Cells(emptyRow, 4).Value = Disputed_Amount.Value
    
    
    End Sub

  2. #2
    Senior Member alansidman's Avatar
    Join Date
    Apr 2012
    Posts
    125
    Rep Power
    13
    What fields would these second set of updates be posted? Are you trying to post multiple values into the sames cells. I am confused by your explanation. Please provide a real example of what you mean to happen.


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40597&p=314054#p314054
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313971#p313971
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313909#p313909
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40574&p=313879#p313879
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313859#p313859
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313855#p313855
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313848#p313848
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313843#p313843
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313792#p313792
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40560&p=313771#p313771
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40560&p=313767#p313767
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40560&p=313746#p313746
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40560&p=313744#p313744
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40560&p=313741#p313741
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313622#p313622
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313575#p313575
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313573#p313573
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313563#p313563
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=313555#p313555
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533
    https://www.eileenslounge.com/viewtopic.php?f=39&t=40265&p=313468#p313468
    https://www.eileenslounge.com/viewtopic.php?f=42&t=40505&p=313411#p313411
    https://www.eileenslounge.com/viewtopic.php?f=32&t=40473&p=313384#p313384
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40501&p=313382#p313382
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40501&p=313380#p313380
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40501&p=313378#p313378
    https://www.eileenslounge.com/viewtopic.php?f=32&t=40473&p=313305#p313305
    https://www.eileenslounge.com/viewtopic.php?f=44&t=40455&p=313035#p313035
    https://www.eileenslounge.com/viewtopic.php?f=18&t=40411&p=312889#p312889
    https://www.eileenslounge.com/viewtopic.php?f=18&t=40411&p=312886#p312886
    https://www.eileenslounge.com/viewtopic.php?f=18&t=40411&p=312752#p312752
    https://www.eileenslounge.com/viewtopic.php?f=18&t=40411&p=312734#p312734
    https://www.eileenslounge.com/viewtopic.php?f=18&t=40411&p=312727#p312727
    https://www.eileenslounge.com/viewtopic.php?f=18&t=40411&p=312724#p312724
    https://www.eileenslounge.com/viewtopic.php?f=44&t=40374&p=312535#p312535
    https://www.eileenslounge.com/viewtopic.php?p=312533#p312533
    https://www.eileenslounge.com/viewtopic.php?f=44&t=40373&p=312499#p312499
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 03-01-2024 at 02:24 PM.

  3. #3
    Member
    Join Date
    Jul 2013
    Posts
    31
    Rep Power
    0
    Dispute Commentary 1.xls

    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.

  4. #4
    Senior Member alansidman's Avatar
    Join Date
    Apr 2012
    Posts
    125
    Rep Power
    13
    I have made some changes/additions to your code. I hope this is what you are looking to do.
    1. Created a text box for COB_Date
    2. Put code behind cancel button
    3. Put code behind clear button
    4. Added code to OK button to clear text boxes after update.
    5. Set tab order of events to follow the order of the text boxes and command buttons.
    6. Added a command button to load the data from the text boxes to the commentary.
    7. Set the properties in the commentary box for multi-line to TRUE

    I did notice that the commentary box does not go anywhere. It is not saved to any particular location on your spreadsheet. Is this an oversight?
    Attached Files Attached Files
    Last edited by alansidman; 10-16-2013 at 08:55 PM.

  5. #5
    Member
    Join Date
    Jul 2013
    Posts
    31
    Rep Power
    0
    Hi Alan - thanks, this is super stuff. Yes, your right, This was an oversight.

    I want the data from the Commentary Textbox to export to excel. However, I would be adding multiple data (COB date/Client Name/Rec owner name) to the commentary text box.
    So in essence, after I click "To Commentary", the text boxes above should get cleared to help me add more data and then click To Commentary Again which would add more line to the commentary text box.

    thanks for your help again.

  6. #6
    Senior Member alansidman's Avatar
    Join Date
    Apr 2012
    Posts
    125
    Rep Power
    13
    Test drive it as it is and make sure it does what is expected before you add new bells and whistles.

  7. #7
    Member
    Join Date
    Jul 2013
    Posts
    31
    Rep Power
    0
    Hey - yes, i checked the codes. It works exactly like what i need. Just need to be able to add more data to the Commentary textbox creating multiple lines.

    "So in essence, after I click "To Commentary", the text boxes above should get cleared to help me add more data and then click To Commentary Again which would add more line to the commentary text box.

  8. #8
    Senior Member alansidman's Avatar
    Join Date
    Apr 2012
    Posts
    125
    Rep Power
    13
    No. The text boxes currently above clear after you click on the OK button. Can you be specific in the steps that you want to take. This will help to design the flow of data using VBA. Right now, I am now sure of the flow of data.

  9. #9
    Member
    Join Date
    Jul 2013
    Posts
    31
    Rep Power
    0
    Hi Alan - 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

  10. #10

Similar Threads

  1. Replies: 14
    Last Post: 06-27-2013, 10:57 AM
  2. Replies: 2
    Last Post: 04-17-2013, 11:53 PM
  3. Print VBA cancel command not working
    By Tony in forum Excel Help
    Replies: 1
    Last Post: 02-07-2013, 07:09 PM
  4. VBA - Split command
    By Rasm in forum Excel Help
    Replies: 1
    Last Post: 09-15-2012, 06:26 AM
  5. Replies: 7
    Last Post: 08-08-2012, 10:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •