+ Reply to Thread
Results 1 to 7 of 7

Delete certain month form data list with months

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Delete certain month form data list with months

    Lets say I have a list with 12 months.
    Then i want to load in a new month.

    Say August, then the code needs to check if August is already in.
    That part I already have covered.

    Now looking for the elegant part that just deletes all the lines of August that are already in (the list is sorted on date).

    Was thinking searching with a match for first and last occurrence and then delete those line numbers.
    But must be a more elegant way? Telling VBA to delete a month without first calculating the start and endrow "myself"?

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete certain month form data list with months


    Just filter and delete ...

  3. #3
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Delete certain month form data list with months

    Just filter and delete???
    It is part of a bigger part of VBA code....

    This is part of this code but it does not want to work.
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete certain month form data list with months


    Activate the Macro Recorder then filter and delete in order to get your own code base ...

  5. #5
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Delete certain month form data list with months

    Ok maybe I should have added a sample.
    What I wanted to know is why this code is not working.

    Keep getting the error "Unable to get the Match property of the WorksheetFunction class"

    when I hover over my variable it is 30-SEP-2022 but the value on first excel sheet is 30-09-22

    Maybe that has something to do with it?
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Delete certain month form data list with months

    Ok found a way around it.

    using application.match and Dim Double did the trick.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete certain month form data list with months


    Well done !

    But for a date you should use Long rather than Double ...

+ 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. Replies: 1
    Last Post: 04-25-2021, 05:50 AM
  2. Vba to filter current month, prior month, two months ago and three months ago
    By M7A0S8T8E5R in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2019, 06:56 PM
  3. Convert list of dates in month / quarter / year format to months only
    By craigsa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-09-2018, 04:33 PM
  4. [SOLVED] How to automatically list months preceding a certain month
    By ramatthews in forum Excel General
    Replies: 5
    Last Post: 05-10-2015, 06:17 PM
  5. Extracting unique months form a long list of dates using array formula
    By Mian USman in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-30-2013, 09:54 AM
  6. Using index to return data from list for last 12 months or months available
    By welchs101 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-23-2013, 09:44 AM
  7. Replies: 7
    Last Post: 03-02-2011, 08:10 AM

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