Forum Discussion

Glaciere's avatar
Glaciere
Copper Contributor
Feb 14, 2025
Solved

Concatenating two lists of numbers of different lengths

I am attempting to concatenate two lists of numbers of differing lengths.  Unfortunately, I am extremely new to this, so any help provided would be greatly appreciated.   In one list I have from 001...
  • HansVogelaar's avatar
    Feb 14, 2025

    If you prefer VBA:

    Sub Expand()
        Dim r As Long
        Dim m As Long
        Dim s As Long
        Dim n As Long
        Dim t As Long
        Dim u
        Dim w
        Application.ScreenUpdating = False
        m = Range("U1").End(xlDown).Row
        u = Range("U1:U" & m).Value
        n = Range("W2").End(xlDown).Row
        w = Range("W2:W" & n).Value
        Range("O2").Resize(m * (n - 1)).NumberFormat = "@"
        t = 1
        For r = 1 To m
            For s = 1 To n - 1
                t = t + 1
                Range("O" & t).Value = u(r, 1) & w(s, 1)
            Next s
        Next r
        Application.ScreenUpdating = True
    End Sub

     

Resources