You can call this procedure at the top of the original code (before the For Each loop) to un-merge previously merged cells before re-merging.
It's possible to automate it based on Worksheet_Change() event or something similar.
To explore the feasibility of the additional features you're looking for, I would need a more detailed description of the "main range" and "shadow range" and how they're linked. If you can type up a dummy example showing both, before and after, and including formulas and formats (and how they're linked) that would be most helpful.
For the first part of your explanation, here comes another question:
Can I just include the un-merge loop into the merge one and have a single complete procedure on workbook change?
The project structure looks like this (I'll try to be short though):
3 daily sheets:
Team1DAY1 - the sheet where the user inputs his projected activities, in a specific range only (3 columns/sub teams and 72 rows = 18 hours split on 15' intervals). Rest of the sheet is readonly (except for a comment range - out of the print area - where he can also add some explanations). The cell values are predefined from a list. No specific formats needed in this sheet, just raw data.
User chooses one value (let's say Column1) and copies it (drags it) to fill an entire interval (square) e.g. 3 columns (4*15 minutes per row = 1 hour for that activity). If he doesn't fill a square, a notice or red highlight should tell him he did it wrong (not implemented yet).
Team2DAY1 – idem
Team3DAY1 – idem
DAY1 - this is the main sheet where the values chosen in the input sheet Team1DAY1 will be replicated in a "shadow" (identical cells range) which is hidden, but from where, in the same sheet DAY1, I built the “Main Range”, which is supposed to gather a daily schedule for all 3 teams in 9 columns * 72 rows, so we can see if there is any conflict between the activities (conditional formatting will highlight the activities that are overlapped). This range is also the one that needs to be nicely formatted based on color codes, to be exported/copied into a powerpoint for a slideshow to the CEO board (the formatting layout is already working nice with the conditional formatting, but same text shows identical in adjacent cells, so I wanted to merge those identical cells for display purposes).
All 4 sheets, after everything will work as expected will be replicated/re-copied for a full 7 days cycle (sheet names will be changed accordingly DAY2 - Team1DAY2, DAY3 – Team1DAY3 and so on).
Links between main sheet and input sheets are based on the indirect function, which helps if sheet names are changed or the sheets replaced/imported from a different workbook (not to break the original formulas), which works nice so far.
I had to make this "main/shadow" range approach in a single sheet due to the limitation of conditional formatting, which works only on the current sheet.
The user will only have the input sheets and no access to the main file (so no DAY1-7 in his workbook). Then his sheets are imported into the main file and the DAY1-7 sheets are updated and formatted based on what he planned.
After de-conflicting the 3 teams’ activities, the final sheets DAY1-7 will generate the ppt for projection on the wall.
During the 7 days, activities might change drastically, so I needed this kind of automation. Before, copy&paste was used and that was such a pain. Human errors on deconflicting could also occur very often.
I hope this gives you a broader idea about this project structure.
I know it’s similar to what Microsoft Project could do, but not all the input users have that installed and the layout of the schedules in MP doesn’t meet our requirements for a nice and feasible display approach.
If you come up with some new ideas about an approach to fully automate this project in a better fashion, it would be more than appreciated.
Thank you so much!