Copy Transpose Paste Vertically Breaking on Blanks

Thomas Hoover

New Member
Joined
Sep 10, 2019
Messages
1
I am new to VBA and coding in general. I am trying to copy/transpose/paste a two-column PivotTable and I need it to paste vertically and break on blank rows. I need to copy each group in the PivotTable and transpose paste values vertically on a new worksheet. I cannot figure out how to capture the populated rows. I am very stuck! Also, I need to determine how to paste into the next open row on the destination worksheet. I have no clue how to code this. Sample of existing code is below:

Set rng = Range("$D$2"$E$" & ActiveSheet.UsedRange.Rows.Count) ' Set range to all used rows in PivotTable

For Each cell In rng
If cell.Value = "" Then
' Found blank row --> need help selecting the group of rows between the blank row
Selection.Copy
Sheets("BH_FH").Activate
Sheets("BH_FH").Range("D2").Select
' Need to paste in the next open row below the previous paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End If
Next cell

I am stuck hard on this problem. Any assistance will be greatly appreciated! Thank you in advance!!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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