+ Reply to Thread
Results 1 to 3 of 3

Macro required to delete rows with multiple conditions

  1. #1
    Forum Contributor
    Join Date
    04-30-2011
    Location
    wirral,england
    MS-Off Ver
    Excel 2010
    Posts
    148

    Macro required to delete rows with multiple conditions

    On the attached spreadsheet I would like to use a macro to delete rows if the following data exists in a number of columns as follows.
    col b equals 1
    col h 6 or less
    col j 6 or less
    col j 49 & over
    col n equals 15
    col s equals 2
    col y 14500 & over
    col aa 10000 & over
    col ag 0.4 & less
    col al -24 & less
    col bb 18 & over
    col bc negative values
    col bc 14 & over
    col bd 13 & over
    col bd contains text "low"
    col bi equals 1
    A shortened version of a larger spreadsheet is attached highlighted in red are the rows to be deleted,highlighted in brown are the rows to be kept.Many thanks for help given.
    Attached Files Attached Files
    Last edited by bigband1; 08-03-2012 at 03:57 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Macro required to delete rows with multiple conditions

    Hello there,

    The below code should work for you:

    Please Login or Register  to view this content.
    To insert the code into your workbook

    1.Press Alt+F8 on your keyboard
    2.Clear the macro name box and type LocateCells in the blank box provided
    3.Select the Create option
    4.In between the Sub LocateCells() and End Sub copy and paste the code I have provided above. (anything that appears in green is a comment that I left for you to help you understand)
    5.Exit out of the Visual Basic Window
    6. Select the workshee that contains the data and Press Alt+F8 again and this time select the LocateCells macro
    7.Select Run


    Let me know if this works for you.

  3. #3
    Forum Contributor
    Join Date
    04-30-2011
    Location
    wirral,england
    MS-Off Ver
    Excel 2010
    Posts
    148

    Re: Macro required to delete rows with multiple conditions

    Works perfectly
    Many Thanks

+ 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