Assuming you have a mixed bag of numbers, then you would use this code:
Sub foo()
Dim lr As Long
lr = Range("C" & Rows.Count).End(xlUp).Row
Dim lra As Long
lra = Range("B" & Rows.Count).End(xlUp).Row
Dim i As Long
For i = 2 To lr
If Len(Range("C" & i)) > 10 Then
Range("D" & i).FormulaR1C1 = "=VLOOKUP(LEFT(RC[-1],2),R2C1:R[" & lra & "]C2,2,FALSE)&"",""&VLOOKUP(" & _
"MID(RC[-1],4,2),R2C1:R[" & lra & "]C2,2,FALSE)&"",""& vlookup(" & _
"mid(RC[-1],7,2),R2C1:R[" & lra & "]C2,2,False)&"",""& VLOOKUP(" & _
"RIGHT(RC[-1],2),R2C1:R[" & lra & "]C2,2,FALSE)"
Else
Range("D" & i).FormulaR1C1 = "=VLOOKUP(LEFT(RC[-1],2),R2C1:R[" & lra & "]C2,2,FALSE)&"",""&VLOOKUP(" & _
"MID(RC[-1],4,2),R2C1:R[" & lra & "]C2,2,FALSE)&"",""& VLOOKUP(" & _
"RIGHT(RC[-1],2),R2C1:R[" & lra & "]C2,2,FALSE)"
End If
Next i
End Sub
Bookmarks