Excelmacros将数据匹配并连接到单个单元格

我已经find了一些macros,可能可以做到这一点,但是我的专业知识是足够好,我可以理解其他答案正在发生的事情,但可惜还不够好修改提出的解决scheme,以适应我需要。 这当然可以避免,如果我可以使用新的TextJoin函数的更新版本的Excel。

我目前有多张相关的数据。 例如:

表1

  ABC ROW 1 Red url1 comment 1 ROW 2 Orange url1 comment 2 ROW 3 Yellow url2 comment 3 ROW 4 Green url3 comment 4 

工作表2

  ABC ROW 1 Red-Bike url1 comment 1-1 ROW 2 Red-Car url1 comment 1-2 ROW 3 Orange-Bike url1 comment 1-3 ROW 4 Yellow-Bike url2 comment 2-1 ROW 5 Green-Bike url3 comment 3-1 

url匹配的行的注释需要连接到第三个表单中,如下所示:

表3

  ABC ROW 1 url1 comment 1 comment 1-1 comment 2 comment 1-2 comment 1-3 ROW 2 url2 comment 3 comment 2-1 ROW 3 url3 comment 4 comment 3-1