Hello. Very new to VBA (very new). I have a spreadsheet with three columns and need to do some work in the last two columns.
[Sheet 1].[Column A] - ID
[Sheet 1].[Column B] - BUILDING
[Sheet 1].[Column C] - DESC
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]ID
[/TD]
[TD="align: center"]BUILDING
[/TD]
[TD="align: center"]DESC
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]L1
L2
[/TD]
[TD]Very Large
Extended
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]L1
L3
L4
[/TD]
[TD]Extra Large
Tiny
Long
[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]S1
[/TD]
[TD]Small
[/TD]
[/TR]
[TR]
[TD]D
[/TD]
[TD]F3
F4
[/TD]
[TD]Fort
Fortable
[/TD]
[/TR]
</tbody>[/TABLE]
Columns B and C can contain multiple 'records' of data which are separated in the same cell by a return sign. For example, ID = A, the text "L1" and "L2" are separated by a paragraph symbol. The same goes for the text in Column C. "Very Large" and "Extended" are separated by a return symbol. The catch he is, the way this system reporting was designed, L1 is connected with Very Large, and L2 is connected with Extended, and L3 is connected with Tiny. So, basically the data which is connected to each other is the same just separated by a paragraph sign.
What I am trying to get VBA for, is to insert as many rows as need to split up the data in columns B and C; and then copy down the ID into the rows below it as well.
ANSWER:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]ID
[/TD]
[TD="align: center"]BUILDING
[/TD]
[TD="align: center"]DESC
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]L1
[/TD]
[TD]Very Large
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]L2
[/TD]
[TD]Extended
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]L1
[/TD]
[TD]Extra Large
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]L3
[/TD]
[TD]Tiny
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]L4
[/TD]
[TD]Long
[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]S1
[/TD]
[TD]Small
[/TD]
[/TR]
[TR]
[TD]D
[/TD]
[TD]F3
[/TD]
[TD]Fort
[/TD]
[/TR]
[TR]
[TD]D
[/TD]
[TD]F4
[/TD]
[TD]Fortable
[/TD]
[/TR]
</tbody>[/TABLE]
[Sheet 1].[Column A] - ID
[Sheet 1].[Column B] - BUILDING
[Sheet 1].[Column C] - DESC
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]ID
[/TD]
[TD="align: center"]BUILDING
[/TD]
[TD="align: center"]DESC
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]L1
L2
[/TD]
[TD]Very Large
Extended
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]L1
L3
L4
[/TD]
[TD]Extra Large
Tiny
Long
[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]S1
[/TD]
[TD]Small
[/TD]
[/TR]
[TR]
[TD]D
[/TD]
[TD]F3
F4
[/TD]
[TD]Fort
Fortable
[/TD]
[/TR]
</tbody>[/TABLE]
Columns B and C can contain multiple 'records' of data which are separated in the same cell by a return sign. For example, ID = A, the text "L1" and "L2" are separated by a paragraph symbol. The same goes for the text in Column C. "Very Large" and "Extended" are separated by a return symbol. The catch he is, the way this system reporting was designed, L1 is connected with Very Large, and L2 is connected with Extended, and L3 is connected with Tiny. So, basically the data which is connected to each other is the same just separated by a paragraph sign.
What I am trying to get VBA for, is to insert as many rows as need to split up the data in columns B and C; and then copy down the ID into the rows below it as well.
ANSWER:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]ID
[/TD]
[TD="align: center"]BUILDING
[/TD]
[TD="align: center"]DESC
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]L1
[/TD]
[TD]Very Large
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]L2
[/TD]
[TD]Extended
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]L1
[/TD]
[TD]Extra Large
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]L3
[/TD]
[TD]Tiny
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]L4
[/TD]
[TD]Long
[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]S1
[/TD]
[TD]Small
[/TD]
[/TR]
[TR]
[TD]D
[/TD]
[TD]F3
[/TD]
[TD]Fort
[/TD]
[/TR]
[TR]
[TD]D
[/TD]
[TD]F4
[/TD]
[TD]Fortable
[/TD]
[/TR]
</tbody>[/TABLE]