Aim: I want to insert the the value in [Col2] & [Numeric Column] as a new row into a template for all where value in [Col1] are same. I also want to use the value in [Col1] in one cell.
Some additional info: Column 1 is the identifier/counterpart for an invoice. Column 2 is the type of product and Numeric Column is the currency amount.
I have a table:
Col1 Col2 Col3 Numeric Column
0001 Value B Ref1 100
0001 Value B Ref2 101
0001 Value C Ref3 99
0002 Value C Ref4 100
0002 Value B Ref5 101
0003 Value C Ref6 99
0004 Value B Ref7 100
0004 Value C Ref8 101
What I am trying to achieve is :
Sub Example()
Dim n As Integer
Dim Source As Worksheet
Dim Target As Worksheet
Set Source = ActiveWorkbook.Worksheets("source")
Set Target = ActiveWorkbook.Worksheets("target")
For each n = 2 in Range([Col1])
//Where the Values in Col1 are the same
//Copy Value in Col 1 to Target Sheet in cell A1 {used only once}
//Copy each value in Col1 - Col3 into row 2 and below for each value where Col 1 is same
How do I set a variable that will continue to do something until the same values in [Col 1] are exhausted, then change to the next set of values in [col 1] without having to reference the unique values of [col 1] in a separate table/sheet?