Results 1 to 4 of 4

Split text box by Return Character

Threaded View

  1. #1
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249

    Split text box by Return Character

    I have a textbox in my userform which has multiline properties available.

    The user can enter more than one line of data in the text box and can enter a list such as the following:

    Adam
    Brian
    Colin
    David

    I have the following code in the userform.

    Dim avarSplit As Variant
    Dim intIndex As Variant
    
    avarSplit = Split((TextBox1), Chr(13))
    For intIndex = LBound(avarSplit) To UBound(avarSplit)
    
    LastRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
    
    Range("A" & LastRow).Value = avarSplit(intIndex)
    
    Next
    The data is split out, however, if there is more than one record it leaves a line gap.

    I have attached an example to show what i mean.

    Is there anyway I can get it so that each line that is entered in the userform is displayed exactly as one line in the relevant cell on the workbook?
    Attached Files Attached Files
    McCrimmon

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