Results 1 to 2 of 2

Thread: Split Text with Delimiter

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    Split Text with Delimiter

    Hi Rick, your code works like a charm however it seems to bomb when it gets unexpected chars or no chars in a cell.

    For example, I have some cells that contain only a "=" or just a period, or just an asterisk, an underscore or anything else and sometimes even nothing. Can it be modified to accept all chars or no chars?

    note: I am using your code to split user notes are up to 512 chars in length. Before I use your code I use the function below to insert a unique delimiter every 79 chars which your code then picks up and makes the rows for me.


    Code:
    Function InsertComma(Text As String) As String
    'inserts delimiter every 79 chars
    If Len(Text) < 80 Then InsertComma = Text
    Dim i As Integer
    Dim t As String
    t = Left(Text, 79)
    For i = 80 To Len(Text) Step 79
    t = t & "|||" & Mid(Text, i, 79)
    Next i
    InsertComma = t
    Application.ScreenUpdating = True
    End Function

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    try this before calling the function
    if instr(your text,"characters") > 0 then
    '''do your stuff'''
    end if
    this will help you to find if char or no char are present in the text

Similar Threads

  1. Replies: 5
    Last Post: 05-28-2013, 03:00 AM
  2. Replies: 4
    Last Post: 05-01-2013, 09:49 PM
  3. Replies: 2
    Last Post: 03-05-2013, 07:34 AM
  4. Split data
    By jan in forum Excel Help
    Replies: 19
    Last Post: 08-12-2012, 02:50 AM
  5. Split Cell and Lookup
    By bsiq in forum Excel Help
    Replies: 4
    Last Post: 11-21-2011, 10:03 PM

Posting Permissions

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