+ Reply to Thread
Results 1 to 9 of 9

Delimit List from TextBox in UserForm to rows

  1. #1
    Registered User
    Join Date
    07-09-2019
    Location
    Michigan, United States
    MS-Off Ver
    2016
    Posts
    4

    Delimit List from TextBox in UserForm to rows

    Hi, I'm brand new to macros and VBA but have been using Excel for a very long time. I'm looking to simplify a tool and calculator I've built with the use of macros and looking to do as follows.

    User will run macro and paste their list into the UserForm's TextBox, we'll call it TextBox1. They press the button, CommandButton1, and the macro takes their list of numbers separated by commas and pastes them into a column in separate rows.

    Example:

    Paste 1,2,3,4,5,6,7,8 in TextBox1

    Paste 555,777,999 in TextBox 2

    Return

    B
    C
    1
    555
    2
    777
    3
    999
    4
    5
    6
    7
    8


    I'd like to be able to choose the column they get pasted in as well and this macro will always be run from the same sheet, so calling out the sheet I think wouldn't be necessary but correct me if I'm wrong.

    I don't want to do this manually as I'm looking to maximize the adoption of this calculator I've built and making it easier will make it more likely to be adopted. I've been scouring the internet and forums for how to do this but can't seem to get a complete answer and, as I'm novice with VBA in its entirety, I'm finding it rather difficult to piece together.
    Attached Files Attached Files
    Last edited by emurray1324; 07-09-2019 at 12:06 PM. Reason: Added Example Workbook

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Delimit List from TextBox in UserForm to rows

    Hi emurray1324,

    Welcome to the forum

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.+

    I realize you may not have buttons or code (or forms) yet, but a mockup of desired output would help illustrate it better.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    07-09-2019
    Location
    Michigan, United States
    MS-Off Ver
    2016
    Posts
    4

    Re: Delimit List from TextBox in UserForm to rows

    I went ahead and edited accordingly.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Delimit List from TextBox in UserForm to rows

    Thanks

    I guess changing the post from B1, B2, to B and C helps... the spacing still threw me off a bit, but the file is exactly what I hoped for. Have to run to a meeting, but if nobody beats me to it, I'll upload a file in a bit.

  5. #5
    Registered User
    Join Date
    07-09-2019
    Location
    Michigan, United States
    MS-Off Ver
    2016
    Posts
    4

    Re: Delimit List from TextBox in UserForm to rows

    I'm also running to a meeting so we'll see when we get back I suppose

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Delimit List from TextBox in UserForm to rows

    Here is a start... you said you wanted to choose the columns to be pasted, right now I made them textboxes, but let me know what needs tweaking.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-09-2019
    Location
    Michigan, United States
    MS-Off Ver
    2016
    Posts
    4

    Re: Delimit List from TextBox in UserForm to rows

    Wow I am extremely impressed. Would it be possible to hardcode the columns to paste the data in? This solution definitely works and upon seeing it, I'd like to limit the end-user's interference as much as possible.

    EDIT: I was able to just lock a value to them in the TextBox properties. I figure that's the least I'm able to do! Thank you very much for leaving the comments in the code as well, it helps me discern the individual pieces.
    Last edited by emurray1324; 07-09-2019 at 01:43 PM.

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Delimit List from TextBox in UserForm to rows

    Since you don't need code for entering the columns, and just want to be able to edit the code, I have taken out all the validation and message box stuff, as well as the check for string/numeric column entries, it significantly cleans up the code. I have left variables for the columns to make it really easy to update them without reading the rest of the code. Looks better too without unnecessary text boxes/labels.

    EDIT: Oops... left in a bit of useless code... delete:

    Please Login or Register  to view this content.
    Attachment updated, but not sure if you had already grabbed it.
    Attached Files Attached Files
    Last edited by Arkadi; 07-09-2019 at 02:01 PM.

  9. #9
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Delimit List from TextBox in UserForm to rows

    Please Login or Register  to view this content.

+ 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. [SOLVED] Add unique data to list using userform and textbox
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-06-2016, 09:32 AM
  2. UserForm: Textbox value load according to drop down list
    By lazyserv in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-31-2015, 05:00 PM
  3. Userform List of Textbox names
    By Isaaq in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2014, 10:28 AM
  4. Replies: 3
    Last Post: 11-19-2014, 02:45 PM
  5. Replies: 2
    Last Post: 02-08-2014, 01:24 PM
  6. [SOLVED] Insert a number of rows according to textbox on userform
    By hoimae in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-16-2012, 09:59 AM
  7. Un-delimit and sum list of numbers in a single cell
    By Saluki in forum Excel General
    Replies: 1
    Last Post: 09-21-2011, 01:04 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