+ Reply to Thread
Results 1 to 5 of 5

Delete rows based on the value of two columns using VBA code - Multiple worksheets

  1. #1
    Registered User
    Join Date
    03-22-2012
    Location
    M, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    45

    Delete rows based on the value of two columns using VBA code - Multiple worksheets

    I have multiple worksheets in my Excel file. From each worksheet, I wish to:

    (1) First, delete all rows except those for which Column1 = 0700, 0701, 0703, or 0704;
    (2) Then, from the remaining records, delete all rows except those for which Column2 = 07, 08, 09, or 10

    The column names (Column1 and Column2) and the placement of those columns (Column1 is under Excel column header "D" and Column2 is under Excel column header "K") is consistent among all of the worksheets.

    How can this be done using VBA code?

    I have no experience at all with VBA, and doing this manually on the many worksheets would be very time-consuming!

    Thank you!!

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Delete rows based on the value of two columns using VBA code - Multiple worksheets

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Delete rows based on the value of two columns using VBA code - Multiple worksheets

    This code runs on all the worksheets. And I don't think you need to think of it as "the remaining records", you can just do both checks on the same pass.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-22-2012
    Location
    M, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Delete rows based on the value of two columns using VBA code - Multiple worksheets

    Thank you--I appreciate your response!

  5. #5
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Delete rows based on the value of two columns using VBA code - Multiple worksheets

    Great! If you feel your questions have been answered sufficiently, please mark this thread as SOLVED.

    And I'm sure anyone who provided good responses would appreciate reputation (the * in the lower left of the posts).

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA code to search multiple columns and delete any duplicate cells (not rows)
    By philmurp in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-16-2014, 03:27 PM
  2. Find and Delete rows based on criteria in multiple columns
    By Doctor_H in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2013, 08:03 PM
  3. [SOLVED] VBA code to delete duplicate rows based on multiple conditions
    By pjsween in forum Excel General
    Replies: 5
    Last Post: 06-27-2012, 01:15 PM
  4. Macro to delete certain columns and delete rows based on time in another column
    By beepbeep27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2012, 11:47 AM
  5. Delete rows/columns across all worksheets
    By ncalsurfer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2009, 06:59 PM

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