Welcome to the board!
Sub CombineCols()
Dim WS As Worksheet
Dim LR As Long
Dim A As Long
Dim I() As Variant
Dim J() As Variant
Set WS = ActiveSheet
'Columns B, D, E, J, K, W
With WS
LR = .Cells(.Rows.Count, "B").End(xlUp).Row
I = .Range("B2:W" & LR)
ReDim J(LR)
For A = 1 To UBound(I, 1)
J(A) = I(A, 1) & "," & I(A, 3) & "," & I(A, 4) & "," & I(A, 10) & "," & I(A, 22)
Next
.Range("AF1").Resize(LR, 1).Value = WorksheetFunction.Transpose(J)
End With
End Sub
But you really don't need VBA to do this.
AF2 =IF(B2<>"",B2&","& D2 & ","&E2&","&J2&","&K2&","&W2, "")
and copy down.
Bookmarks