+ Reply to Thread
Results 1 to 7 of 7

Macro to convert the text in to string.

  1. #1
    Registered User
    Join Date
    10-21-2010
    Location
    Akron,OH, USA
    MS-Off Ver
    Excel 2007
    Posts
    44

    Macro to convert the text in to string.

    I have a text file with lines. All I want to do is convert line text into number. I want to declare them as array.and output them in different cells in worksheet.
    Example:
    if one of the text line is-

    Text input:
    C390007797109040100000530000000031000040000000016

    Excel output:
    A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 M1 N1 O1
    C 39 000779 7 1 09 04 01 00 00053 00000 00031 00004 00000 00016
    (1, 2, 6, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5) -> Length on the numbers
    the text file has several lines. So there should be a loop to go through the end of file.
    Please help me.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to convert the text in to string.

    Just a thought but have you considered using Text To Columns? If the text is a fixed width format you should be able to split it using that.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    10-21-2010
    Location
    Akron,OH, USA
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Macro to convert the text in to string.

    how can i do that? text into column will be okay for me.

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to convert the text in to string.

    On the Data tab, in the Data Tools group, click Text to Columns. Use the Fixed Width option.

    Dom

  5. #5
    Registered User
    Join Date
    10-21-2010
    Location
    Akron,OH, USA
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Macro to convert the text in to string.

    No. I need array of these data for later use. so I cannot use the fixed width option. can you help me with that?

  6. #6
    Registered User
    Join Date
    10-21-2010
    Location
    Akron,OH, USA
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Macro to convert the text in to string.

    I have a C++ code for this problem. here is the code:
    Please Login or Register  to view this content.
    Please anyone help me to convert it into a macro.
    Thank you.

  7. #7
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to convert the text in to string.

    Sorry, not a clue about C++

    Dom

+ 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