shimon.amar
Board Regular
- Joined
- Nov 20, 2012
- Messages
- 93
Hello dear fellows, how are you today?
My manager gave me a task and I need your help. I need a VBA that will do the follows-
I have a long list of data -
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Account[/TD]
[TD]Headline 2[/TD]
[TD]Headline 3[/TD]
[TD]Unit[/TD]
[/TR]
[TR]
[TD]125123[/TD]
[TD]Asset[/TD]
[TD]NIZ003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]123511[/TD]
[TD]Asset[/TD]
[TD]DSE003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]212334[/TD]
[TD]Liability[/TD]
[TD]SDS003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]125211[/TD]
[TD]Asset[/TD]
[TD]CDE004[/TD]
[TD]BGT004[/TD]
[/TR]
[TR]
[TD]214122[/TD]
[TD]Liability[/TD]
[TD]DEF004[/TD]
[TD]BGT004[/TD]
[/TR]
</tbody>[/TABLE]
I need a VBA that in each change in column "Unit", it will open 2 rows in between the lines.
In the first row that will open it will take the data from column "headline 2" in the first row before the change and in the second row that opened it will take the data from "Headline 3" from the first row before the change and etc.
The outcome of the example should be like this-
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Account[/TD]
[TD]Headline 2[/TD]
[TD]Headline 3[/TD]
[TD]Unit[/TD]
[/TR]
[TR]
[TD]Asset[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]NIZ003[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]125123[/TD]
[TD]Asset[/TD]
[TD]NIZ003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]123511[/TD]
[TD]Asset[/TD]
[TD]DSE003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]212334[/TD]
[TD]Liabiluty[/TD]
[TD]SDS003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]Asset[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]CDE004[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]125211[/TD]
[TD]Asset[/TD]
[TD]CDE004[/TD]
[TD]BGT004[/TD]
[/TR]
[TR]
[TD]214122[/TD]
[TD]Libility[/TD]
[TD]DEF004[/TD]
[TD]BGT004[/TD]
[/TR]
</tbody>[/TABLE]
The lines the need to be automatically added are colored in Red.
Thanks in advance for your efforts and the help.
My manager gave me a task and I need your help. I need a VBA that will do the follows-
I have a long list of data -
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Account[/TD]
[TD]Headline 2[/TD]
[TD]Headline 3[/TD]
[TD]Unit[/TD]
[/TR]
[TR]
[TD]125123[/TD]
[TD]Asset[/TD]
[TD]NIZ003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]123511[/TD]
[TD]Asset[/TD]
[TD]DSE003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]212334[/TD]
[TD]Liability[/TD]
[TD]SDS003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]125211[/TD]
[TD]Asset[/TD]
[TD]CDE004[/TD]
[TD]BGT004[/TD]
[/TR]
[TR]
[TD]214122[/TD]
[TD]Liability[/TD]
[TD]DEF004[/TD]
[TD]BGT004[/TD]
[/TR]
</tbody>[/TABLE]
I need a VBA that in each change in column "Unit", it will open 2 rows in between the lines.
In the first row that will open it will take the data from column "headline 2" in the first row before the change and in the second row that opened it will take the data from "Headline 3" from the first row before the change and etc.
The outcome of the example should be like this-
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Account[/TD]
[TD]Headline 2[/TD]
[TD]Headline 3[/TD]
[TD]Unit[/TD]
[/TR]
[TR]
[TD]Asset[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]NIZ003[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]125123[/TD]
[TD]Asset[/TD]
[TD]NIZ003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]123511[/TD]
[TD]Asset[/TD]
[TD]DSE003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]212334[/TD]
[TD]Liabiluty[/TD]
[TD]SDS003[/TD]
[TD]BGT003[/TD]
[/TR]
[TR]
[TD]Asset[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]CDE004[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]125211[/TD]
[TD]Asset[/TD]
[TD]CDE004[/TD]
[TD]BGT004[/TD]
[/TR]
[TR]
[TD]214122[/TD]
[TD]Libility[/TD]
[TD]DEF004[/TD]
[TD]BGT004[/TD]
[/TR]
</tbody>[/TABLE]
The lines the need to be automatically added are colored in Red.
Thanks in advance for your efforts and the help.