+ Reply to Thread
Results 1 to 8 of 8

Delete cells in a column between cells that have key words in them.

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    Dothan, Alabama
    MS-Off Ver
    Excel 2007
    Posts
    4

    Delete cells in a column between cells that have key words in them.

    I am copying data from a web site to creat a excel data base. Sometimes the data will populate 8 rows and other times 9 rows. I have formulas set up to parse the strings. I need a macro that will delete all the cells in between the cells with the key words. I copy this data and paste it to another sheet.
    Last edited by bh36303; 11-12-2012 at 10:00 AM.

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Delete cells in a column between cells that have key words in them.

    I'm betting that if you attached a spreadsheet that shows what data you have, where it is, and what data you want saved for copying, someone on here would be able to help you out. It's best to not leave geniuses guessing. Strange things happen when geniuses resort to guessing. Strange things, indeed.

    - Moo

  3. #3
    Registered User
    Join Date
    09-26-2012
    Location
    Dothan, Alabama
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Delete cells in a column between cells that have key words in them.

    Here is my attachement.Attachment 192746
    Attached Files Attached Files

  4. #4
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Delete cells in a column between cells that have key words in them.

    Here's the code used in the attached sheet. Run it WITH SAMPLE DATA -or- A COPY OF YOUR ACTUAL DATA! Remember... there is no "UNDO" when running macros! You can run it in the attached file. It doesn't matter if there are 8 rows or 9, because it will always look for the lastrow (lr) with a value in column A, then delete from A2:lastrow - 1, and shift the rest of column A up.
    Please Login or Register  to view this content.
    Hope it helps!

    - Moo
    Attached Files Attached Files
    Last edited by Moo the Dog; 11-10-2012 at 03:28 AM. Reason: updated code to include sheet references

  5. #5
    Registered User
    Join Date
    09-26-2012
    Location
    Dothan, Alabama
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Delete cells in a column between cells that have key words in them.

    Moo,
    That worked great but I didn't give you enough details. I have data underneath that I need to keep. I have attached a file with the original data that I am working with. I apologize for the lack of details.

    Brett
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,522

    Re: Delete cells in a column between cells that have key words in them.

    Do you mean like this?
    Please Login or Register  to view this content.

  7. #7
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Delete cells in a column between cells that have key words in them.

    Thanks Jindon. Was just about to post a similar response then saw yours. Good work.

    - Moo

  8. #8
    Registered User
    Join Date
    09-26-2012
    Location
    Dothan, Alabama
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Delete cells in a column between cells that have key words in them.

    jindon,
    That worked perfect. Thankyou very much.

+ 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