Deleting rows older than 6 months starting at row 5?

jmpatrick

Active Member
Joined
Aug 17, 2016
Messages
477
Office Version
  1. 365
Platform
  1. Windows
Good morning! I'm using this code that found here on the board:

VBA Code:
    Dim i As Long
    Dim lr As Long
    Application.ScreenUpdating = False
    lr = Sheets("Calendar").Range("B" & Rows.Count).End(xlUp).Row
    With Sheets("Calendar")
    For i = lr To 1 Step -1
        If .Cells(i, 2).Value < Date - 183 Then .Cells(i, 2).EntireRow.Delete
    Next
    End With

How do I have it skip the top 4 rows and only scan the dates in column B in row 5 and below?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi
If I have understood change For i = lr To 1 Step -1 in For i = lr To 5 Step -1

Bye,
Mario
 
Upvote 0
Solution

Forum statistics

Threads
1,215,133
Messages
6,123,235
Members
449,092
Latest member
SCleaveland

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top