Results 1 to 3 of 3

Showing rows in listbox that are older than 2 months based and delete

Threaded View

sniper1 Showing rows in listbox that... 04-24-2020, 08:46 PM
bakerman2 Re: Showing rows in listbox... 04-25-2020, 01:47 AM
Pepe Le Mokko Re: Showing rows in listbox... 04-25-2020, 04:55 AM
  1. #1
    Registered User
    Join Date
    04-24-2020
    Location
    USA
    MS-Off Ver
    WA
    Posts
    64

    Showing rows in listbox that are older than 2 months based and delete

    Hi Excel Ninjas!

    I am having an issue where I can't seem to figure out how to fill a listbox with rows that only 2 months old based/compare the data value to a Now() function in row "R". I also would like to multiselect the values and click delete to remove them from the sheet ("Test").

    I have headers on A1 to M, data starts on row 2. Also my Listsource is a dynamic list name"ItemList". I am tinkering this code, but no success.

    Sub DeleteData()
    
    Dim i as integer
    Dim rng as Range
    
    last = Cells(Rows.Count, "A").End(xlUp).Row
    Set rng = Range("A1:A" & last)
    
    For i = last To 1 Step -1
    If rng(i).Value = Listbox1.value Then 
    rows(i).Entirerow.Delete
    End If
    Next
    
    End Sub
    Results: nothing. Selected items are not deleting from sheet "Test".

    Thank you!
    Last edited by Pepe Le Mokko; 04-25-2020 at 04:55 AM. Reason: Code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Counting entries and ignoring older than 6 months
    By Akradon in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-25-2015, 12:32 PM
  2. Delete Rows if Date in Column A is Older Than 6 Years
    By BantamPCI in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-12-2014, 06:13 AM
  3. How do a delete rows with specific months
    By dalewms3 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-28-2014, 12:40 AM
  4. [SOLVED] Delete if older than 3 months and offsetting a cell input if match found
    By Templemind in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-27-2014, 07:25 AM
  5. Excel Formula Showing Revenue Recognition Based on Days and Months
    By stratcat3345 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-16-2014, 06:13 AM
  6. Delete Rows with dates older than previous Friday
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2013, 04:51 PM
  7. Macro to compare multiple columns then delete rows with older dates
    By azurememories in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2011, 05:43 PM

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