Yes, the SubMains may have more than 8 columns but the 1st and 2nd have to be at least 1 column more than all the rows of the SubInfo.
Here is where the test is done to calculate the rows of the SubInfo. Column "H" may be changed but must be at least 1 more than the SubInfo:
No need to put a blank row in between the SubMains, just change 1 line of the macro:
To work the macro needs to find in your sheet at least 2 SubMains and the first set of SubInfo after the first SubMain.
You can easily calculate your total rows to avoid the crash. You know how many rows your sheet manages so ... you know how SubMains you have, you know how many rows a SubInfo has ... just multiply.
Bookmarks