Segregating dates via month

Chopper50

New Member
Joined
Mar 14, 2013
Messages
30
I have used a filter in my VBA code to sort a date column Oldest to newest.
List of dates:
9/12/2018
9/15/2018
10/15/2018
11/26/2018
12/1/2018
12/30/2018
1/5/2019
1/30/2019
2/1/2019
3/1/2019
etc

I would like code to keep everything prior to current date in same grouping as current month then insert a blank row after the 12/30/18 another blank row after 1/30/2019 and another blank row after 2/1/2019.

I've been struggling. Started with If statements then thought I'd go to Select Case. I can't get it all to come together.
Thanks for the help.
Chad
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
How about
Code:
Sub SplitMonths()
   Dim i As Long
   
   For i = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
      If Range("A" & i).Value <= Date Then Exit For
      If month(Cells(i, 1)) <> month(Cells(i - 1, 1)) Then Rows(i).Insert
   Next i
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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