+ Reply to Thread
Results 1 to 11 of 11

Delete Unwanted Data

  1. #1
    Registered User
    Join Date
    09-16-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Delete Unwanted Data

    I need to import a text file into excel and do the following :

    This text file is broken into “Information on object # 1 through #35. In each of these objects I would like to extract the NAME row and SEGMENT LENGTH row and delete the rest. CAN ANY BODY HELP.

    Some times these files are 1000's of objects so I need to automate it some how.

    Thanks in advance for your help!
    Attached Files Attached Files
    Last edited by lweng; 09-16-2010 at 12:15 PM.

  2. #2
    Forum Contributor
    Join Date
    10-17-2007
    Location
    Washington, DC
    Posts
    103

    Re: Search and destroy!!

    Here you go.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    05-27-2008
    Location
    Newcastle Upon Tyne UK
    MS-Off Ver
    XP Excel 2003
    Posts
    105

    Re: Search and destroy!!

    A very straight forward way:

    Select Column C and D Copy paste special values

    Delete Column A and B

    Sort columns A and B by A descending.

    edvwvw

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Search and destroy!!

    Give this a try:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 09-16-2010 at 12:07 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    09-16-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Search and destroy!!

    --------------------------
    Last edited by lweng; 09-16-2010 at 11:37 AM.

  6. #6
    Registered User
    Join Date
    09-16-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Search and destroy!!

    -----------------------------
    Last edited by lweng; 09-16-2010 at 11:37 AM.

  7. #7
    Registered User
    Join Date
    09-16-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Search and destroy!!

    I got it working now! Thanks that’s exactly what I need. I appreciate your help. Could you make it so It deletes the (string) off the back side of the segment length column? And add a column with the NAME? Thank you for your help!!!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete Unwanted Data

    Yes, this a macro.

    How/Where to install the macro:

    1. Open up a blank workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save as a macro-enabled workbook

    The macro is installed and ready to use.

    A. Press Alt-F8
    B. Select ImportObjectList from the macro list
    C. The macro will prompt you to select the text file on your hard drive
    D. The macro will do the rest
    B.

  9. #9
    Registered User
    Join Date
    09-16-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Delete Unwanted Data

    I got it working now! Thanks that’s exactly what I need. I appreciate your help. Could you make it so It deletes the (string) off the back side of the segment length column? And add a column with the NAME? Thank you for your help!!!

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete Unwanted Data

    Try this:
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    09-16-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Delete Unwanted Data

    Thank you… I appreciate your help!

+ 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