+ Reply to Thread
Results 1 to 5 of 5

Delete Row based on cell value through multiple worksheets

  1. #1
    Registered User
    Join Date
    05-18-2010
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2003
    Posts
    3

    Delete Row based on cell value through multiple worksheets

    Hi,

    I have used a Macro that looks at the values in a certain column and deletes the row if it meets the specified criteria, in this instance it is any grade that is an F or higher, code below.

    Please Login or Register  to view this content.
    The macro works which is great. However, the workbook I am working on has multiple worksheets which also need to be checked using the same rules but the column order varies. For example, in Sheet1 the data is in column 16, in Sheet2 the data is in column 10....each column has the same heading.

    Is there a way of identifying which column holds the relevant data, select it and then run the above VBA?

    Any help would be greatly appreciated.

  2. #2
    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 Row based on cell value through multiple worksheets

    Perhaps. How would the macro determine it should use column 16 on sheet1, column 10 on sheet2, etc?
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    05-18-2010
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Delete Row based on cell value through multiple worksheets

    That's another piece of the puzzle....Each Column will have the same Heading so is there a way of scanning the row with the column headings, identifying the one we want, "Grade Level", and then performing the deletion macro?

    Thanks

  4. #4
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Delete Row based on cell value through multiple worksheets

    This should do what you want:

    Please Login or Register  to view this content.
    I assumed that your headings are located on row 1 and your data starts on row 2 of each sheet. It can be changed if that's not the case. I hope that helps.
    Last edited by Pichingualas; 08-08-2012 at 12:48 PM.
    .?*??)
    `?.???.?*??)?.?*?)
    (?.?? (?.?
    Pichingualas <---
    ??????????????????????????

    Wrap your code with CODE TAGS.
    Thank those who helped you, Don't forget to add to their REPUTATION!!! (click on the star below their post).
    Please mark your threads as [SOLVED] when they are (Thread Tools->Mark thread as Solved).

  5. #5
    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 Row based on cell value through multiple worksheets

    This should be a but faster overall since it only deletes once on each sheet, deleting all the found rows at the same time. Also, it will only evaluate cells in the Grade Level column that have an entry in them, even if there are blanks in the middle of the dataset, it will get them all.

    Please Login or Register  to view this content.

+ 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