+ Reply to Thread
Results 1 to 6 of 6

VBA text to column problem

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    VBA text to column problem

    Hi There, I have the following code that I use to split data in column B.

    My problem is that when the "split" has taken place - the data isn't aligned to the correct row. For instance the data that should be in B4 - ends up in B3.

    The coding is part of a long looping macro. All i want it to do is split the text to columns as in the code but to the correct line

    Any help please?

    Please Login or Register  to view this content.

  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
    48,972

    Re: VBA text to column problem

    I suggest that you post a sample workbook with typical data and the full code.

    Regards, TMS
    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
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: VBA text to column problem

    Ok i have attached a sample.

    What i need to do (and it maybe best if someone provides brand new code) - is extract the scores from column B.

    The problem is that there are 2 different field types. The ones near the top are formatted as 3:1 (2:0, 1:1) (I need number 3 in column C and number 1 in column D), and the lower games are formatted 00:01 (I need 0 in column B and 1 in column C).

    I am struggling with VBA code for text to columns to split the data as it keeps formatting the 0 as 12 (presumbably a time feature).

    If anyone could have a look at my example and tell me the best way to extract the score as above I would be greatful
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: VBA text to column problem

    hi cmb80, formula option if it's acceptable solution
    Attached Files Attached Files
    Last edited by watersev; 05-06-2012 at 05:01 PM.

  5. #5
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: VBA text to column problem

    Hi there watersev - that is more than acceptable - thank you very much for that. What took you probably 5 mins has taken me over 4 hours today!

  6. #6
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: VBA text to column problem

    Just one quick query - will the formula work for 2 digit scores (I mean 10+) or is it only to capture single digit scores?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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