Isso faz exatamente o que você pediu
Option Explicit
Sub OoohEckPirates()
Dim table1Start As Integer
table1Start = 2 ' UPDATE ME
Dim table2Start As Integer
table2Start = 7 ' UPDATE ME
Dim resultsTableStart As Integer
resultsTableStart = 12 ' UPDATE ME
'Create the header
Range("A11").Value = "UID Header" ' UPDATE ME
Range("B11").Value = "Name Header" ' UPDATE ME
Range("C11").Value = "Value Header" ' UPDATE ME
Dim header1Row As Integer
Dim header2Row As Integer
Dim resultsRow As Integer
Dim col As Integer
col = 65 'UPDATE ME - 65 = A, 66 = B, 67 = C. So, if your first column is A, set it to 65
Dim currentUid As String
header1Row = table1Start
resultsRow = resultsTableStart
Do While (Range("A" & header1Row).Value <> "")
currentUid = Range("A" & header1Row).Value
header2Row = table2Start
Do While (Range(Chr(col) & header2Row).Value <> "")
Range(Chr(col) & resultsRow).Value = currentUid
Do While (Range(Chr(col) & header2Row).Value <> "")
Range(Chr(col + 1) & resultsRow).Value = Range(Chr(col) & header2Row).Value
col = col + 1
Loop
col = 65
header2Row = header2Row + 1
resultsRow = resultsRow + 1
Loop
header1Row = header1Row + 1
Loop
End Sub
Antes de executá-lo, faça um backup, só para ter certeza
Como eu adiciono o VBA no MS Office?
Antes
Depois