• Copy from text box (2000 sr1)

    Author
    Topic
    #374147

    I am populating a text box in a user form with several lines of data. I move down a line using vbCrlf.
    If I manually select the text and copy it to another sheet everything is fine. If I try to automate it using:
    Range(“A1”)=userform1.textbox1.text
    I get everything in a single cell and can’t use text to columns because of the delimeter.
    Any ideas on what I can use to copy the text from the userform text box to a sheet?

    Viewing 0 reply threads
    Author
    Replies
    • #604427

      The simplest and most straightforward way might be to put each required field in a separate text box within the user form, using the change event to update the cell. You can use the tab property to move from one required textbox to the next within the userform.

      • #604812

        Thanks… The macro to populate the text box is pulling in values from multiple cells and concatenating them in the text box.
        For instance a user can select S, M, L, LX and the text box will display the sales Last Year, This Year, % Change, and % of total for each.
        What I would like is if they want to add the text from the text box to a sheet to compare with sales for another segment, they simply select a button that would then copy to another sheet.

        • #604830

          SOLVED!!!

          I found the following in Excel’s help:
          TextBox1.SelStart = 0
          TextBox1.SelLength = TextBox1.TextLength
          TextBox1.Copy

          All I have to do then is add a sheet and use activesheet.paste. It formats it perfectly!

    Viewing 0 reply threads
    Reply To: Copy from text box (2000 sr1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: