if previous column data in merged cell, count merged rows, combine data in next column corresponding rows in to 1 row

leecavturbo

Well-known Member
Joined
Jan 4, 2008
Messages
681
a1-a3 are merged, data in unmerged b1-b3 correspond to data in a1-a3. combine data from b1-b3 to b1. then unmerge a1-a3
then delete empty rows
then repeat down.

EG
(11-sep vis is in merged a1-a3. pretty pigs is in b1,tamworth in b2 and b in b3) so cut tamworth and b and paste on the end of pretty pigs. now unmerge a1-a3 and then delete empty row 2 and 3. then repeat down until no data in column a


11-Sep VIS PRETTY PIGS
TAMWORTH
B
11-Sep BP ADAMS
BOARD

FIXED UNMERGED

11-Sep VIS PRETTY PIGS TAMWORTH B
11-Sep BP ADAMS BOARD
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hiya
Give this a go on a copy of your data
Code:
Sub UnMergeMe()

    Dim CurCl As Range
    Dim NxtCl As Range
    Dim Rws As Integer
    Dim I As Integer

    Set CurCl = Range("A1")
    Do
        Set NxtCl = CurCl.Offset(1)
        Rws = NxtCl.Row - CurCl.Row - 1
        CurCl.UnMerge
        For I = Rws To 1 Step -1
            CurCl.Offset(I - 1, 1) = CurCl.Offset(I - 1, 1) & " " & CurCl.Offset(I, 1)
            CurCl.Offset(I).EntireRow.Delete
        Next I
        Set CurCl = CurCl.Offset(1)
    Loop While CurCl.Value <> ""


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,582
Members
449,039
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top