Results 1 to 6 of 6

Concatenating issue with code

Threaded View

  1. #1
    Registered User
    Join Date
    12-02-2011
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    73

    Concatenating issue with code

    hi,

    I have a situation wherein cell content in column A is same but they are not joined as expected with my code:-

    Sub mergenumbers()
        Dim lngRow As Long
    
        With ActiveSheet
            Dim columnToMatch As Integer: columnToMatch = 1
            Dim columnToConcatenate As Integer: columnToConcatenate = 2
            
    
            lngRow = .Cells(65536, columnToMatch).End(xlUp).Row
            .Cells(columnToMatch).CurrentRegion.Sort key1:=.Cells(columnToMatch), Header:=xlYes
    
            Do
                If .Cells(lngRow, columnToMatch) = .Cells(lngRow - 1, columnToMatch) Then
                    .Cells(lngRow - 1, columnToConcatenate) = .Cells(lngRow - 1, columnToConcatenate) & vbCrLf & .Cells(lngRow, columnToConcatenate)
                    .Rows(lngRow).Delete
                End If
    
                lngRow = lngRow - 1
            Loop Until lngRow = 1
        End With
    End Sub
    i am not sure but something is wrong with the cell content format? Am i missing something here? attached is sheet to test.
    Last edited by chilli16; 08-02-2018 at 10:44 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Concatenating product names by category code
    By ilsley_excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2016, 12:37 PM
  2. [SOLVED] Concatenating two columns and reversing after concatenating the result
    By irfanparbatani in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-22-2014, 09:35 PM
  3. problem concatenating the filename to the code
    By safisam in forum Excel General
    Replies: 7
    Last Post: 09-06-2009, 03:14 AM
  4. Fixing VBA code to better suit concatenating needs!!
    By Sandwiches2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2006, 10:35 PM
  5. concatenating and formatting area code and phone number columns
    By sherri in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-07-2005, 12:05 AM
  6. [SOLVED] concatenating and formatting area code and phone number columns
    By sherri in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  7. [SOLVED] concatenating and formatting area code and phone number columns
    By sherri in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 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