+ Reply to Thread
Results 1 to 5 of 5

Macro for delete filtered data

  1. #1
    Registered User
    Join Date
    11-18-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Macro for delete filtered data

    Hi,

    Please help to prepare a macro that will perform following steps.

    1. Filter out & delete data with 'ABC' (column header) containing 'AB' or 'BC'
    2. Filter out & delete data with "Date" (column header) between today till 30 days prior (today - 30). Now we are left with the data which are more than 30 days older.

    Thanks.
    Last edited by VKR; 02-09-2013 at 07:48 AM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Macro for delete filtered data

    Hi, VKR,

    you can narrow down the data by either using the Autofilter or Advanced Filter for further working - is it really necessary to delete all the other data? Either approach could be used as well (just with different selection) as a loop or an array to perform that action.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    11-18-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Macro for delete filtered data

    I have solved my first point but still working on second. I have a code but not able to fit criteria to full fill my expectations. Please give some suggestion on this.

    rngData.AutoFilter Field:=k, Criteria1:="= *****", Operator:=xlOr, Criteria2:="******"

    What should be criteria to filter date column today till 30 days prior (today - 30days)?

    Appreciate your response.

    Thanks,
    VKR

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Macro for delete filtered data

    hHi, VKR,

    maybe something like
    Please Login or Register  to view this content.
    although I donīt know if the range or the variable k are fitting.

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    11-18-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Macro for delete filtered data

    It worked after a little modifiction. Thank you so much.

+ 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