TextToColumns Method of Range Object

     

  • Split the data into multiple columns using TEXTTOCOLUMNS method
  • Application considers delimiter as Tab,Space,Comma,Semicolon,OtherChar
  •  

    Click on below mentioned image to watch video:

     

    Download The Workbook

     

    Sub TextToColumns_Method_Of_Range_Object()

    'Clear existing data
    Range("C2:F7").ClearContents


    'Comma
    Range("B2").TextToColumns Destination:=Range("C2"), DataType:=xlDelimited, comma:=True



    'Space
    Range("B3").TextToColumns Destination:=Range("C3"), DataType:=xlDelimited, Space:=True



    'SemiColon
    Range("B4").TextToColumns Destination:=Range("C4"), DataType:=xlDelimited, Semicolon:=True



    'Tab
    Range("B5").TextToColumns Destination:=Range("C5"), DataType:=xlDelimited, Tab:=True



    'Other - OtherChar -- %
    Range("B6").TextToColumns Destination:=Range("C6"), DataType:=xlDelimited, other:=True, otherchar:="%"



    'Other - OtherChar -- # --- Not to consider space as delimiter
    Range("B7").TextToColumns Destination:=Range("C7"), DataType:=xlDelimited, Space:=False, other:=True, otherchar:="#"

    End Sub