• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Exceptions on Text Segmentation Code

Gatu

New Member
Hi

How can I insert some exceptions into this code:

Code:
Sub TextZeilenErstellen()
Application.ScreenUpdating = False
 
    iRow = 0        ' Text inserted from here
    iColumn = 2        ' Text inserted from here
    icount = 1
 
 
    While icount < Range("A65536").End(xlUp).Row + 1
        iM = 1: Text$ = Cells(icount, 1)
        icount = icount + 1
        If Len(Trim(Text$)) > 1 Then
          For f = 1 To Len(Text$)
                Select Case Mid$(Text$, f, 1)
                    Case ".", ";", ":", "!", "?"
                    iRow = iRow + 1
                    Cells(iRow, iColumn) = Trim(Mid$(Text$, iM, f - iM + 1))
                    iM = f + 1
                End Select
            Next f
        End If
        If f > iM Then iRow = iRow + 1: Cells(iRow, iColumn) = Trim(Mid$(Text$, iM, f - iM + 1))
    Wend
Application.ScreenUpdating = True
End Sub

This code segmentates a tex inside of a hole Excel column, say you have

aaaaaaaaaaaa. bbbbbbbbbbbbbbbbb. ccc; ddddddddd: ssssssss!

and it will segmentate like

aaaaaaaaaaaa.
bbbbbbbbbbbbbbbbb.
ccc;
ddddddddd:
ssssssss!

However, now I would like to find how to insert some exceptions, for example,
"etc." "e. g." and so on...
 
Back
Top