+ Reply to Thread
Results 1 to 6 of 6

Code for Text to columns using spaces

Hybrid View

  1. #1
    Registered User
    Join Date
    01-24-2019
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    96

    Code for Text to columns using spaces

    Hello all,

    Is there a VBA code to select from range A3 to used range of A columns to do Text to columns delimited with spaces?

    I tried to do with record macro but I couldn't achieve it

  2. #2
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Code for Text to columns using spaces

    what about the command texttocolumns? do you know how to use that?

    it is found under the Data menu, then goto Data Tools and select Text to Columns.

    do you need further help?

  3. #3
    Registered User
    Join Date
    01-24-2019
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    96

    Re: Code for Text to columns using spaces

    @dmcgov

    I'm looking for code to automate. Thanks for your reply

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,918

    Re: Code for Text to columns using spaces

    Sub TextToCol()
        Dim lr As Long
        lr = Range("A" & Rows.Count).End(xlUp).Row
        Range("A1:A" & lr).TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
                                         TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
                                         Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
                                                                                                  :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
    End Sub
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    01-24-2019
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    96

    Re: Code for Text to columns using spaces

    Thanks for the code Alan!! It works fine!!

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,918

    Re: Code for Text to columns using spaces

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Dir listing - text to columns problem with spaces in filenames
    By fcbm in forum Excel General
    Replies: 9
    Last Post: 04-10-2019, 11:30 AM
  2. Replies: 9
    Last Post: 12-31-2018, 01:29 PM
  3. Replies: 12
    Last Post: 03-14-2016, 08:42 AM
  4. [SOLVED] vba to split the cell values text to columns with undelimited spaces
    By MicroTees in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2016, 06:47 AM
  5. Replies: 1
    Last Post: 10-17-2014, 02:16 AM
  6. [SOLVED] Code for random spaces for text to column in VBA
    By ndemetres in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2014, 04:38 PM
  7. Text to columns with Fixed With but Keep Spaces
    By bigbavarian in forum Excel General
    Replies: 4
    Last Post: 09-23-2009, 11:13 AM

Tags for this Thread

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