+ Reply to Thread
Results 1 to 8 of 8

Need help/ideas for a tricky row and column delete Macro

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    Vancouver,Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Need help/ideas for a tricky row and column delete Macro

    Hello! I'm new to the world of Excell Macro's and was wondering if anyone might have a simple Macro I could run that would compare Columns A and B then Delete Columns B through E for every row where Columns A and B do not match.

    It gets tricky because the macro would need to start at row 1 and makes its way down the spreadsheet row by row shifting the cells up (columns B through E) as it deletes them. I'm sure this might be a simple thing to do for anyone with experience in this area but I'm somewhat baffled by it and could use any assistance provided. Thank you!

    Sincerely,

    Mr Noob

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Need help/ideas for a tricky row and column delete Macro

    Quote Originally Posted by Antony680 View Post
    compare Columns A and B then Delete Columns B through E for every row where Columns A and B do not match.
    The text marked in bold and red color is not clear to me. Whether the Column B to column E cells needs to be deleted or the entire row needs to be deleted?

    If Column B to column E cells needs to be deleted then which method should be used to delete (i.e.) shift cells up or shift cells left?
    Last edited by :) Sixthsense :); 10-30-2012 at 02:32 AM. Reason: Correction in sentence


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    10-30-2012
    Location
    Vancouver,Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need help/ideas for a tricky row and column delete Macro

    Hello Sixthsense!

    Thank you for your reply. Column B to column E cells need to be deleted and shift cells up method should be used. I really hope this isn't a difficult one. Thanks again

  4. #4
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Need help/ideas for a tricky row and column delete Macro

    Hi -

    For me the deletion process is not needed, seems like finding a match between column A and B then pull those records in another sheet is much simple.

    Regards,
    event

  5. #5
    Registered User
    Join Date
    10-30-2012
    Location
    Vancouver,Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need help/ideas for a tricky row and column delete Macro

    I wonder if that could work. Its tricky because Column A goes 1,5,8,9,etc and Column B goes 1,2,5,6,9,etc. Perhaps if it is possible to write a Macro that would take Columns B-E and copy it to a separate spreadsheet in any instances where Column B matches Column A. Yes, I believe that might accomplish the same thing

    I really hope a macro can be generated. So far I have been manually deleting Column B cells and shifting the cells up so that the lists match up properly. There are thousands of lines and I'm only a quarter of the way through.

  6. #6
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Need help/ideas for a tricky row and column delete Macro

    Hi -

    Post some dummy data.

    Regards,
    event

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Need help/ideas for a tricky row and column delete Macro

    Quote Originally Posted by Antony680 View Post
    Hello Sixthsense!

    Thank you for your reply. Column B to column E cells need to be deleted and shift cells up method should be used. I really hope this isn't a difficult one. Thanks again
    Test the below macro in COPY OF YOUR WORKBOOK.

    Copy and paste the below macro in standard module and Press Alt+F8 and select DeleteMismatches and run.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-30-2012
    Location
    Vancouver,Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need help/ideas for a tricky row and column delete Macro

    Thank you! That wasnt quite it but I think I know what I need to do now and this certianly helped a lot.

+ 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