In a Pivot - I have Animals in Column A and the list of 10 animals are populated in Column B, I want all the 4 to be merged to the first Cell

ms48210

New Member
Joined
Mar 6, 2016
Messages
2
In a Pivot - I have Animals in Column A and the list of 4 animals are populated in Column B, I want all the 4 to be merged to the first Cell, My Pivot has values in Green and I want the green to be converted like the below RED, Need a formula or macro to convert a huge list.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Animals[/TD]
[TD]Dog[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Lion[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Tiger[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Goat[/TD]
[/TR]
[TR]
[TD]Birds[/TD]
[TD]Pigeon[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Crow[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Eagle[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Sparrow[/TD]
[/TR]
[TR]
[TD]Animals[/TD]
[TD]Dog
Lion
Tiger
Goat
[/TD]
[/TR]
[TR]
[TD]Birds[/TD]
[TD]Pigeon
Crow
Eagle
Sparrow
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hello, hope this helps:

Code:
Sub test()

Dim i As Integer
Dim lr As Integer
Dim rng As Range

Set rng = [b1]

lr = Cells(Rows.Count, 2).End(xlUp).Row
[b1].Select

Application.ScreenUpdating = False

    For i = 1 To lr

        If ActiveCell.Offset(1, -1).Value <> "" Then
        ActiveCell.Offset(1, 0).Select
        Set rng = ActiveCell
        End If

    rng.Value = rng.Value & Chr(10) & ActiveCell.Offset(1, 0).Value
    ActiveCell.Offset(1, 0).EntireRow.Delete

        If ActiveCell.Offset(1, 0).Value = "" Then
        Exit Sub
        End If
          
    Next i
   
Application.ScreenUpdating = True
   
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

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