Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 06-28-2018, 08:15 PM
NoSparks NoSparks is offline Merging multiple header row contents into one cell Windows 7 64bit Merging multiple header row contents into one cell Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Quote:
Originally Posted by emmorel View Post
The suggested Vba Macro provided the results I was looking for. Below is a small sample of the output.
By chance is there a few words missing in the above quote?

Are you now saying the new sample output is what you would prefer?
If so, try this way
Code:
Sub MergeCodes_v2()
    Dim i As Long, lr As Long
    Dim rng As Range, cel As Range
    Dim str As String
    
With Sheets("Sheet1")    '<~~ change to actual sheet name
    lr = .Range("A" & Rows.Count).End(xlUp).Row
    'add row for merge string
    For i = lr To 2 Step -1
        If Len(.Cells(i, "A")) = 10 Then
            .Rows(i + 1).Insert
        End If
    Next i
    'recalc lastrow
    lr = .Range("A" & Rows.Count).End(xlUp).Row
    Set rng = .Range("A2:A" & lr)
End With
    
For Each cel In rng
    cel.Select
    If cel.Value = "" Then
        For i = 1 To lr
            If Len(cel.Offset(i).Value) < 10 And cel.Offset(i).Value <> "" Then
                str = str & ", " & cel.Offset(i).Value
            Else
                cel.Value = Mid(str, 3)
                cel.Font.Bold = False
                str = ""
                Exit For
            End If
        Next i
    End If
Next cel
    
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging 2 different cells containing IF formula & change in cell values based on multiple time frame jay_excel Excel 0 07-29-2017 11:04 PM
Merging multiple header row contents into one cell Selection from cell with list contents autopopulates contents of another cell markharper80 Excel 3 02-16-2015 04:18 PM
Merging multiple header row contents into one cell Merging multiple .txt's Bartestokles Word 5 12-29-2010 01:42 PM
Merging Multiple Copies of the Same Document bshatto Word 0 10-19-2009 06:22 AM
Merging multiple header row contents into one cell How to eliminate Header on Contents Page George99 Word 1 12-06-2008 09:59 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft