Hello Everyone
Thanks for taking the time to view this post. I am familiar with macros but the language is sometimes confusing to me sometimes and I can get overwhelmed.
I have a raw data set that includes Categories and SubCategories.
***************************************
Here is an example in Table (given) Format:
[TABLE="class: grid, width: 200"]
<tbody>[TR]
[TD]Parent[/TD]
[TD]Sub1[/TD]
[TD]Sub2[/TD]
[TD]Sub3[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cabinet[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cabling[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cash[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7402[/TD]
[TD]CD[/TD]
[/TR]
</tbody>[/TABLE]
*****************************
Same example Outlined (thought process):
Level II Services
I need to create general code that will iterate through the input / given table and separate the categories and subcategories in a waterfall-like pattern.
Visually:
If B2 != empty (or i,j != empty)
Here is an example of what I need as an output:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Level II Services[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cabinet[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cabling[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cash[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7402[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7402[/TD]
[TD]CD[/TD]
[/TR]
</tbody>[/TABLE]
Alternate way of looking at it:
Copying row i and pasting on row i+1, (i,j+1)
Help? Creating a new sheet (input: sheet1, output: sheet2) is fine
Thanks for taking the time to view this post. I am familiar with macros but the language is sometimes confusing to me sometimes and I can get overwhelmed.
I have a raw data set that includes Categories and SubCategories.
***************************************
Here is an example in Table (given) Format:
[TABLE="class: grid, width: 200"]
<tbody>[TR]
[TD]Parent[/TD]
[TD]Sub1[/TD]
[TD]Sub2[/TD]
[TD]Sub3[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cabinet[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cabling[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cash[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7402[/TD]
[TD]CD[/TD]
[/TR]
</tbody>[/TABLE]
*****************************
Same example Outlined (thought process):
Level II Services
- Hardware
- 7401
- Cabinet
- Cabling
- Cash
- 7402
- CD
- 7401
I need to create general code that will iterate through the input / given table and separate the categories and subcategories in a waterfall-like pattern.
Visually:
If B2 != empty (or i,j != empty)
I need to copy the contents of A1 into A2, and move the contents of B2 to B3 (or i+1, j).
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
would look break out into
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Level II Services[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[/TR]
</tbody>[/TABLE]
etc.
I then need to continue looping through the ith row and looking at next-right column (j+1) to check if it is != empty, and keep moving the contents until I reach the end of row i, and then I need to move onto row i+1
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
would look break out into
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Level II Services[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[/TR]
</tbody>[/TABLE]
etc.
I then need to continue looping through the ith row and looking at next-right column (j+1) to check if it is != empty, and keep moving the contents until I reach the end of row i, and then I need to move onto row i+1
Here is an example of what I need as an output:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Level II Services[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cabinet[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cabling[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7401[/TD]
[TD]Cash[/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7402[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level II Services[/TD]
[TD]Hardware[/TD]
[TD]7402[/TD]
[TD]CD[/TD]
[/TR]
</tbody>[/TABLE]
Alternate way of looking at it:
Copying row i and pasting on row i+1, (i,j+1)
Help? Creating a new sheet (input: sheet1, output: sheet2) is fine
Last edited: