+ Reply to Thread
Results 1 to 2 of 2

Macto to copy words from text file to excel

  1. #1
    Registered User
    Join Date
    01-06-2013
    Location
    israel
    MS-Off Ver
    Excel 2003
    Posts
    1

    Macto to copy words from text file to excel

    hi,
    I need to writing the following macro,
    Importing from a text file into Excel.
    The problem is this:
    I have a huge file (several hundred thousand lines), should go line by line to look for a specific word (each time a different word) and copy the word beside into an Excel file.

    Search should be carried out by block rows that starts and ends with the word DES
    The same word appears thousands of times and each time have to copy the word next to it.

    An example of the text file:

    DES NO
    TN 002 0 05 03
    TYPE 500
    CDEN SD
    CUST 0
    DN 54216 0 MARP
    ANIE 0
    AST NO
    IAPG 0
    HUNT 58686
    TGAR 7
    LDN NO
    NCOS 4
    SGRP 0
    RNPG 0
    LNRS 16
    XLST 0
    SCI 0
    SCPW 0000
    SFLT NO
    CAC_CIS 3
    CAC_MFC 3
    CLS CTD DTN FBD XFA WTA THFD FND HTA ONS
    LPR XRA AGRD CWD SWD MWA RMMD SMWD LPD XHD SLKD CCSA-CSI TEND LNA TVD
    CFTD SFD MRD C6D CNID CLBD AUTU
    ICDD CDMD LLCN EHTD MCTD
    GPUA DPUA CFXD ARHD OVDD AGTD CLTD LDTD ASCD
    MBXD CPFA CPTA UDI RCC HBTD IRGD IAMD DDGA NAMA MIND
    NRWD NRCD NROD SPKD CRD PRSD MCRD
    EXR0 SHL SMSD ABDD CFHD DNAA DNDY DNO3
    CWND USRA BNRD OCBD RTDA RBDD RBHD FAXD CNUD CNAD PGND FTTU
    FDSD NOVD
    RCO 0
    PLEV 02
    AACS NO
    MLWU_LANG 0
    ARTO 1
    FTR CFW 5
    FTR FDN 52127
    FTR AFD 58686
    FTR AHNT 58686
    DATE 24 OCT 2012

    DES ALEX
    TN 008 0 00 00
    TYPE 2616
    CDEN 8D
    CTYP XDLC
    CUST 0
    AOM 0
    FDN
    TGAR 7
    LDN NO
    NCOS 4
    SGRP 0
    RNPG 0
    SCI 0
    SSU
    LNRS 16
    XLST 0
    SCPW 0000
    SFLT NO
    CAC_CIS 3
    CAC_MFC 3
    CLS CTD FBD WTA LPR MTD FND HTD ADD HFA HOR3
    MWD LMPN RMMD SMWD AAD IMD XHD IRA NIA OLA VCE DRG1
    POD DSX VMD CMSD SLKD CCSA-CSI TEND SWD LNA CNDA
    CFTD SFD MRA DDV CNID CDCA MSIA DAPA BFED RCBD
    ICDD CDMD LLCN MCTD CLBD AUTU
    GPUA DPUA DNDD CFXD ARHD FITD CLTD ASCD
    CPFA CPTA ABDD DELD CFHD FICD NAIA DNAA RDLA BUZZ AGRD MOAD
    UDI RCC HBTD AHD IPND DDGA NAMA MIND PRSD NRWD NRCD NROD
    DRDD EXR0
    USRA ULAD RTDD RBDD RBHD PGND OCBD FLXD FTTU DNDY DNO3 MCBN
    FDSD NOVD
    CPND_LANG ENG
    HUNT
    LPK 2
    PLEV 02
    AST
    IAPG 0
    AACS NO
    ITNA NO
    DGRP
    MLWU_LANG 0
    DNDR 0
    KEY 00 SCR 57509 0 MARP
    ANIE 0
    01 ADL 16
    02 ADL 16
    03 ADL 16
    04 TRN
    05 AO6
    06 CFW 5 52795
    07 RGA
    08 ADL 16
    09 ADL 16 9052234735
    10 ADL 16
    11 ADL 16 11
    DATE 27 FEB 2012

    I find the word first DES, then I need to copy the word next to TN next word by TYPE,
    Whenever there next TYPE certain number (five types of numbers) so you have to look for another sequence of words)
    I have a line starting for example in "TYPE" and copy the number 500 (near TYPE can be five types of numbers)
    That is when I find the number 500 I need to copy what's next DN, CDEN, CUST, NCOS, and more.

    If I have the number 2616 so I have to copy other words. like 500 end another/

    Hope made ​​myself clear.

    Thank you

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macto to copy words from text file to excel

    Quote Originally Posted by maor.wn View Post
    Hope made ​​myself clear.
    not for me, a sample file (text and desired xls) will be useful
    If solved remember to mark Thread as solved

+ 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