【发布时间】:2015-03-10 09:27:39
【问题描述】:
这是我在这里的第一篇文章,但我过去经常访问以寻求帮助。
我正在寻找一个宏来根据集合中的项目数减去 1 在每个条目之间插入特定数量的行,然后插入每个组合。
我会尽力举例。
假设我有大量的收藏品,每个收藏品都是独一无二的。我想与该集合中的每个项目建立一对一的关系。因此,如果我有集合Red 与项目1、2 和3 以及集合Blue 与项目A、B、C、E 和@987654 .
我的工作簿中有 3 列。
Collection, Primary Item, Relationship Item
Row 1 = Red, 1.
Row 2 = Red, 2.
Row 3 = Red, 3.
Row 4 = Blue, A.
Row 5 = Blue, B.
Row 6 = Blue, C.
Row 7 = Blue, D.
Row 8 = Blue, E.
我的目标是在 Red 集合的每一行之间插入 2 行,在 Blue 集合的每一行之间插入 4 行。然后复制新空白列中的每个集合和目标项以及关系项中的每个相关项。
这会变成这样:
Collection, Target Item, Relationship Item
Row 1 = Red, 1, 2.
Row 2 = Red, 1, 3.
Row 3 = Red, 2, 1.
Row 4 = Red, 2, 3.
Row 5 = Red, 3, 1.
Row 6 = Red 3, 2.
Row 7 = Blue, A, B.
Row 8 = Blue, A, C.
Row 9 = Blue, A, D.
Row 10 = Blue, A, E.
Row 11 = Blue, B, A.
Row 12 = Blue, B, C.
Row 13 = Blue, B, D.
Row 14 = Blue, B, E.
Row 15 = Blue, C, A.
Row 16 = Blue, C, B.
等等。
这将需要多次使用,其中包含不同数量的集合和项目。
我希望我的描述已经足够详细,如果您对如何简化我的解释有任何问题或建议,请告诉我。
【问题讨论】: