There is always a "." between the values.
Try this code. Using arrays would be much faster for huge list of names/values:
Sub test()
Dim arrVal As Variant
Dim arrNames As Variant
Dim arrRes As Variant
Dim v, n, k As Long
'change Sheet1 to suit
With ThisWorkbook.Worksheets("Sheet1")
'change A1:A3 to values address
arrVal = .Range("A1:A3")
'change B1:B3 to names address
arrNames = .Range("B1:B3")
ReDim arrRes(1 To UBound(arrVal) * UBound(arrNames), 1 To 1)
k = 1
For Each v In arrVal
For Each n In arrNames
arrRes(k, 1) = Left(v, InStr(1, v, ".")) & n & Mid(v, InStr(1, v, "."))
k = k + 1
Next
Next v
'change "c1" to start cell where to put new values
.Range("C1").Resize(UBound(arrRes, 1)) = arrRes
End With
End Sub
Note: If you don't know exact addresses of "values" and "name" ranges, change this part
'change A1:A3 to values address
arrVal = .Range("A1:A3")
'change B1:B3 to names address
arrNames = .Range("B1:B3")
to
'change A1:A to "values" address
arrVal = .Range("A1:A" & .Cells(.Rows.Count, "A").End(xlUp).Row)
'change B1:B to "names" address
arrNames = .Range("B1:B" & .Cells(.Rows.Count, "B").End(xlUp).Row)
In that case "values" and "name" ranges starts from A1
and B1
accordingly and ends in the last non empty row in coumns A
and B
accordingly.
Result: