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.

AnimalsDog
Lion
Tiger
Goat
BirdsPigeon
Crow
Eagle
Sparrow
AnimalsDog
Lion
Tiger
Goat
BirdsPigeon
Crow
Eagle
Sparrow

<tbody>
</tbody>
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,215,046
Messages
6,122,854
Members
449,096
Latest member
Erald

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