How to group columns based on date with VBA?

Occasional Visitor

So I have this worksheet for tracking the status of several projects over time (like a gantt chart but not exactly one) and I think it would be better for visualization if the columns were automatically grouped together based on month/year, since there's a lot of columns. I'm struggling to figure out a code for this, my worksheet looks something like this:



and the date columns should be grouped by month and year.

I'd be really grateful if someone could help me with this!



1 Reply


If you try to group the columns for January, then group the columns for February, Excel will create one group covering January and February instead.

Would it be OK to insert empty columns between the months? They can be very narrow.