jbesclapez
Active Member
- Joined
- Feb 6, 2010
- Messages
- 275
Hi Mr Excel
I have a table that can change in rows/columns. In this table I only have one data per row. The columns indicate the hierarchy of parent child structure. The parent is on the left.
For example :
[TABLE="width: 500"]
<tbody>[TR]
[TD]Level1[/TD]
[TD]Level2[/TD]
[TD]Level3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1218[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1219[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1220[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A1200[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1110[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1111[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A1100[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A1000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
So from the previous table we have this hierarchy. Please note that the A1000 is the root so it has no parent
[TABLE="width: 500"]
<tbody>[TR]
[TD]Parent[/TD]
[TD]Child[/TD]
[/TR]
[TR]
[TD]A1200[/TD]
[TD]A1218[/TD]
[/TR]
[TR]
[TD]A1200[/TD]
[TD]A1219[/TD]
[/TR]
[TR]
[TD]A1200[/TD]
[TD]A1220[/TD]
[/TR]
[TR]
[TD]A1000[/TD]
[TD]A1200[/TD]
[/TR]
[TR]
[TD]A1100[/TD]
[TD]A1110[/TD]
[/TR]
[TR]
[TD]A1100[/TD]
[TD]A1111[/TD]
[/TR]
[TR]
[TD]A1000[/TD]
[TD]A1100[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A1000[/TD]
[/TR]
</tbody>[/TABLE]
I would like to have a VBA where you select the table above - whatever the depth level - and it creates the parent child table elsewhere.
I can read VBA but this level is too high for me. I will rearrange it all for my needs if you can help me create the difficult part.
Thanks
I have a table that can change in rows/columns. In this table I only have one data per row. The columns indicate the hierarchy of parent child structure. The parent is on the left.
For example :
[TABLE="width: 500"]
<tbody>[TR]
[TD]Level1[/TD]
[TD]Level2[/TD]
[TD]Level3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1218[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1219[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1220[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A1200[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1110[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A1111[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A1100[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A1000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
So from the previous table we have this hierarchy. Please note that the A1000 is the root so it has no parent
[TABLE="width: 500"]
<tbody>[TR]
[TD]Parent[/TD]
[TD]Child[/TD]
[/TR]
[TR]
[TD]A1200[/TD]
[TD]A1218[/TD]
[/TR]
[TR]
[TD]A1200[/TD]
[TD]A1219[/TD]
[/TR]
[TR]
[TD]A1200[/TD]
[TD]A1220[/TD]
[/TR]
[TR]
[TD]A1000[/TD]
[TD]A1200[/TD]
[/TR]
[TR]
[TD]A1100[/TD]
[TD]A1110[/TD]
[/TR]
[TR]
[TD]A1100[/TD]
[TD]A1111[/TD]
[/TR]
[TR]
[TD]A1000[/TD]
[TD]A1100[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A1000[/TD]
[/TR]
</tbody>[/TABLE]
I would like to have a VBA where you select the table above - whatever the depth level - and it creates the parent child table elsewhere.
I can read VBA but this level is too high for me. I will rearrange it all for my needs if you can help me create the difficult part.
Thanks