Guinaba
Board Regular
- Joined
- Sep 19, 2018
- Messages
- 218
- Office Version
- 2016
- Platform
- Windows
Hi experts,
Need some help, I have two tables: List1 and List2:
List1
List2
I have to loop through both tables adding the Metrics col from (List2) into each row of List1 creating a third table (List3)
List3
I've started the following VBA code but couldn't finished off.
Need some help, I have two tables: List1 and List2:
List1
Brand | Item ID | Item Desc | Item Size |
---|---|---|---|
Star | 33333 | blablabla | small |
Planet | 44557 | blablabla | medium |
Moon | 78786 | blablabla | large |
List2
Metrics |
---|
AA |
AB |
I have to loop through both tables adding the Metrics col from (List2) into each row of List1 creating a third table (List3)
List3
Brand | Item ID | Item Desc | Item Size | Metrics |
---|---|---|---|---|
Start | 33333 | blablabla | small | AA |
Start | 33333 | blablabla | small | AB |
Planet | 44557 | blablabla | medium | AA |
Planet | 44557 | blablabla | medium | AB |
Moon | 78786 | blablabla | large | AA |
Moon | 78786 | blablabla | large | AB |
I've started the following VBA code but couldn't finished off.
VBA Code:
Sub PopulateMetrics()
Dim List1 As ListObject
Dim List2 As ListObject
Dim oRow As ListRow
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("WW_Portfolio")
Dim ws2 As Worksheet
Set ws2 = ThisWorkbook.Worksheets("WOW Metrics")
Dim ws3 As Worksheet
Set ws3 = ThisWorkbook.Worksheets("Template")
Dim i As Long
Set List1 = ws1.ListObjects("tPortfolio")
Set List2 = ws2.ListObjects("tMetricsALL")
For Each oRow In List1.ListRows
ws3.Range("A" & oRow) = oRow.Range(1)
Next oRow
End Sub