Results 1 to 9 of 9

Alter Solution of a thread to " Concatenate Data" solved by MickG

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Alter Solution of a thread to " Concatenate Data" solved by MickG

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Mark a thread "Solved"
    By FORTRANguru in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2014, 07:41 PM
  2. Solution to populate cell with "X" by selecting "R"
    By nirola in forum Excel General
    Replies: 4
    Last Post: 11-17-2012, 10:15 AM
  3. I don't see a button/Switch to select "Thread Solved"
    By NewToExcel-2007 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 09-05-2010, 10:46 AM
  4. Replies: 0
    Last Post: 08-07-2006, 01:35 AM
  5. Replies: 0
    Last Post: 07-17-2006, 09:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1