+ Reply to Thread
Results 1 to 6 of 6

VBA User Form needs to accept multiple lines/breaks pasted in it

  1. #1
    Registered User
    Join Date
    04-02-2013
    Location
    Knoxville, TN
    MS-Off Ver
    Office 365
    Posts
    15

    Question VBA User Form needs to accept multiple lines/breaks pasted in it

    Hello all!

    Basically, the sheet I have records reorders for product. Currently, it only accepts one item at a time. We can copy multiple lines from our ordering software, and they can paste into Word or another Excel sheet fine. However, my user form will only accept the first line when pasted into it. Is there something I can add to my code to get it to accept multiple lines/breaks into the box?

    The user form ID is frmInput

    Thanks for the help!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: VBA User Form needs to accept multiple lines/breaks pasted in it

    How/where are you entering multiple reorders?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    04-02-2013
    Location
    Knoxville, TN
    MS-Off Ver
    Office 365
    Posts
    15

    Re: VBA User Form needs to accept multiple lines/breaks pasted in it

    Quote Originally Posted by Norie View Post
    How/where are you entering multiple reorders?
    Each reorder may consist of multiple items. We are copying these items from an inventory program called SAP, which uses spreadsheet functionality.

    Lets say an order looks like this. (Numbers on the left are line items)
    10 Product A
    20 Accessory
    30 Installation
    40 Product B
    50 Accessory
    60 Installation

    If the customer needs to return Product A, the user needs to copy lines 10-30, and paste them into the user form. Once copied, the user can paste into Word or Excel, and it will appear correctly. However, the User Form I currently have will only paste the first line. The form I created is for notating the reorder.

    Thanks for the reply!

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: VBA User Form needs to accept multiple lines/breaks pasted in it

    So what are you actually putting in the textbox?

  5. #5
    Registered User
    Join Date
    04-02-2013
    Location
    Knoxville, TN
    MS-Off Ver
    Office 365
    Posts
    15

    Re: VBA User Form needs to accept multiple lines/breaks pasted in it

    Quote Originally Posted by Norie View Post
    So what are you actually putting in the textbox?
    The users are pasting the copied values/cells from SAP. They would copy:
    10 Product A
    20 Accessory
    30 Installation

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: VBA User Form needs to accept multiple lines/breaks pasted in it

    That's only one reorder isn't it and only the first line of that is being copied to Word/Excel?

    How are you doing the copy/paste?

    I don't see anything in that code that's doing that or even putting values on a worksheet.

    If you wanted to put all 3 lines of that example data in one cell in Excel the code would simply be this.
    Please Login or Register  to view this content.
    If you wanted it in each line in a separate row then you could look into splitting the contents of the textbox using Split an an appropriet delimiter.

    Split would, hopefullly, return a 3 dimensional array which you could put in 3 rows like this.
    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)

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