Text to Columns Automation

Split text in cells based on delimiters like commas, spaces, or custom characters

137 views

Perfect For:

  • Split names into first/last
  • Separate addresses
  • Parse CSV data
VBA Code
Sub TextToColumnsAutomation()
    Dim ws As Worksheet
    Dim dataRange As Range
    Dim delimiter As String

    Set ws = ActiveSheet
    delimiter = InputBox("Enter delimiter (comma, semicolon, space, etc.):", "Delimiter", ",")

    If delimiter = "" Then Exit Sub

    ' Select the range containing text to split
    Set dataRange = Application.InputBox("Select range to split:", Type:=8)

    ' Split the text using the specified delimiter
    dataRange.TextToColumns Destination:=dataRange, _
        DataType:=xlDelimited, _
        Other:=True, _
        OtherChar:=delimiter, _
        ConsecutiveDelimiter:=False

    MsgBox "Text split into columns successfully!"
End Sub

Related Topics

text split columns delimiter

Need Custom VBA Solutions?

Our AI-powered VBA generator can create custom code tailored to your specific requirements in seconds.

Generate Custom VBA Code

Related Templates

More VBA templates in the same category

Intermediate

Create Sheet Per Unique Value

Automatically create separate worksheets for each unique value in a column. Perfect for splitting...

View Template