+ Reply to Thread
Results 1 to 2 of 2

Macro to Delete items where ageing in col M is less than or equal to 90

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,767

    Macro to Delete items where ageing in col M is less than or equal to 90

    I have tried to write code below to delete all items in Col M where ageing is less than or equal to 90


    I have highlighted the rows to be deleted

    When running the macro, no rows are being deleted

    It would be appreciated if someone could assist me



     Sub Delete_itemslessthan90()
    Dim LR As Long, i As Long
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    For i = LR To 2 Step -1
    With Sheets("Maturities")
    LR = Cells(.Rows.Count, "A").End(xlUp).Row
    
    If .Cells(i, 13).Value <= 90 Then
    .Rows(i).EntireRow.Delete
     End If
    End With
    Next i
     Application.ScreenUpdating = True
     Application.EnableEvents = True
    End Sub

  2. #2
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,767

    Re: Macro to Delete items where ageing in col M is less than or equal to 90

    I have managed to resolve issue, by amending my code as follows:


      Sub Delete_itemslessthan90()
    Dim LR As Long, I As Long
     With Sheets("Maturities")
            
    LR = .Cells(.Rows.Count, "A").End(xlUp).Row
    For I = LR To 2 Step -1
    If .Cells(I, 13) <= 90 Then
    .Rows(I).Delete
    End If
    Next I
            End With
    
    End Sub

+ 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. [SOLVED] Macro to delete rows where Values are oposite & Equal Col H
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-12-2020, 02:24 AM
  2. [SOLVED] Macro to delete certain items then count remaining items #2
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-21-2019, 02:26 PM
  3. [SOLVED] Macro to delete certain items then count remaining items
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-14-2019, 03:20 PM
  4. Replies: 3
    Last Post: 07-04-2014, 09:57 PM
  5. Replies: 5
    Last Post: 06-12-2014, 02:48 PM
  6. Macro code to delete entire row if cell in column A is equal to a value
    By mm671750 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-07-2014, 02:54 PM
  7. Macro to delete entire rows where O2:O does not equal a date
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2011, 10:37 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