+ Reply to Thread
Results 1 to 4 of 4

VBA Macro error on Text to Columns

  1. #1
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    VBA Macro error on Text to Columns

    Hi,

    I've recorded a macro which transforms some raw data into a reportable format and this includes separating out a column within a table range which holds both a date and an attribute into two columns.

    When I recorded this step, I used fixed width to separate out the two columns, because the date is in numerical value format e.g. 42736.

    When I ran the macro through to see if it worked, it got stuck on this process. Below is the VBA code, any suggestions on how to modify this to work??

    Selection.TextToColumns Destination:=Range("Table1_2[[#Headers],[Attri]]"), _
    DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(5, 1)), _
    TrailingMinusNumbers:=True

    p/s I checked the table name as I figured it might have specified the table name from my recording but it's not - the table is called Table1_2.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,440

    Re: VBA Macro error on Text to Columns

    ... it got stuck on this process.
    What does that mean?

    Post a sample workbook and instructions on how you run the macro.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: VBA Macro error on Text to Columns

    It's ok I figured out what was wrong.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,440

    Re: VBA Macro error on Text to Columns

    Ok, good. Might be worth sharing the solution for the benefit of others.

+ 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. Error when using 'text to columns' in macro
    By Adam1989 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2016, 06:51 AM
  2. [SOLVED] error using text to columns
    By Quicksnot in forum Excel General
    Replies: 1
    Last Post: 10-07-2015, 02:51 PM
  3. Error in Text to columns loop due to parameter
    By icyrius in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-11-2013, 06:17 AM
  4. VBA Text To Columns Error
    By Steve0492 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-03-2013, 07:01 AM
  5. MAcro to - copy, transpose, text to columns, remove column A, combine all columns in 1
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-07-2013, 08:48 AM
  6. [SOLVED] "Run-time error '13': type mismatch when running macro to add text to end of text
    By nrjordan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2012, 10:34 PM
  7. text to columns date error when using Macro
    By AntDingle in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-02-2009, 11:01 PM

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