+ Reply to Thread
Results 1 to 4 of 4

Deleting rows macro

  1. #1
    Forum Contributor
    Join Date
    04-30-2013
    Location
    arizona
    MS-Off Ver
    365
    Posts
    147

    Deleting rows macro

    I need a macro that can do the following:

    First: I am looking for a macro that will delete every row (11-1000) that has a value in G column that is greater than the value in cell (M2). For example if (G11) had a value of 16 and (G12) had a value of 50 and cell (M2) had a value of 40 then row 12 would be deleted because 50 is greater than 40 and row 11 would not be deleted.

    Secondly: I need the macro to do the same search as above but for column F rows (1-1000) and I need to compare each value in column F rows (11-1000) to cell (K2). I am comparing cars. I need the values in Column F to not be older than 15 years of the year in (K2). It can be younger, just not older than 15 years. For example, if cell F11 had a year of 1955 and cell F12 had a year of 1999 and cell K2 had a year of 2000 then row 11 would be deleted because 1955 is more than 15 years older than 2000 but 1999 is younger than 15 years so it will not be deleted.

    Lastly, I want these macros to apply to every sheet except for sheets “Sheet1”, “Sheet2” and “Sheet3”.
    I have attached a spreadsheet to help.

    Can anyone help me with this?
    Attached Files Attached Files
    Last edited by glide2131; 06-25-2013 at 04:40 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Deleting rows macro

    Let me know if the following does what you need:
    Please Login or Register  to view this content.
    Edit: This procedure does not go through the sheets.
    Last edited by Mordred; 06-07-2013 at 10:15 PM.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Deleting rows macro

    Please Login or Register  to view this content.
    David
    (*) Reputation points appreciated.

  4. #4
    Forum Contributor
    Join Date
    04-30-2013
    Location
    arizona
    MS-Off Ver
    365
    Posts
    147

    Re: Deleting rows macro

    Works well thank you.

+ 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