I'm not quite sure what the purpose of the group "total" is. Am I right in thinking that it's to distinguish between group items, and optional ones?
Anyway, you've got conflicting interests here... in the _Change() routine, you haven't switched off Application.EneableEvents. This has the effect of changing the names successfully i.e. if you put "Tim" in E14 it populates the cells above, as intended, by triggering a new Worksheet_Change() instance for each cell.
Leaving Application.EnableEvents = true, however, will cause a separate iteration of the Worksheet_Change() event, and it can cause a infinite loops. I think that's your problem with the line
Each change triggers another Worksheet_Change() event which results in the error you have seen. (I've not been able to replicate that, specifically, but there seem to be several anomalies causing problems.)
Additionally, although I've not spent a lot of time analysing it, you'll notice that sometimes you get "Runtime Error 1004" - not enough memory. The reason for that is because this
never completes. If you press "Debug" on the error message and hover the cursor over the word "row" you'll see it's looped beyond 1.04 million times.
One final observation (before I go nuts)... your line
only defines column as Integer... row is a Variant as the type isn't defined. This may cause a problem further down when you're evaluating cell values. If the cell value contains a number, but you're looking for "1", you're actually comparing a number with a string. On reflection, I wonder whether that's the issue with this looping forever:
I've re-attached a copy of my original reply, slightly modified with the extra "totals" column, and with optional items simply placed below the table for each kit. If the "Totals" column doesn't do what you want it to, you can simply exclude it from the other events for the table body by uncommenting the additional line I've put there; change it to an If ... Then statement to make it do what you want if you don't just want to exit at that point.
You could, also, trigger additional events to automate things for the optional items if you want to.
Tim
Bookmarks