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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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