I need to Concatenate mulipe discontinuous columns, these columns are constantly changing, so in one project it might be
Columns a, e, g, k, l
And in another
Columns g,k,l,o,aa
There might be a lot of data 100,00 rows so a fast solution is desirable, I found this Here: http://www.excelforum.com/excel-prog...te-tables.html
And a solution to the thread by @MickG and altered it to Concatenate the first two rows but how to generalize it to Concatenate mulipe discontinuous columns?
Thanks
Option Explicit
Private Sub CommandButton21_Click()
Dim Rng As Range, Dn As Range, n As Long, Q As Variant
Set Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If Not IsEmpty(Dn.Value) Then
If Not .Exists(Dn.Value) Then
.Add Dn.Value, Array(Dn.Value, Dn.Offset(, 1) & "|" & Dn.Offset(, 2), "")
Else
Q = .Item(Dn.Value)
Q(2) = Dn.Offset(, 2).Value
.Item(Dn.Value) = Q
End If
End If
Next
Range("I2").Resize(.Count, 3) = Application.Index(.items, 0, 0)
End With
End Sub
Bookmarks