Copying Horizontallyand Pasting Vertically

babar1988

New Member
Joined
Mar 10, 2022
Messages
11
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. Web
Hi,

I am using the below code copying horizontally from one workbook and pasting vertically to another. but once pasting it's making a mess.

Sub Alldrrdata()
Dim sourceworkbook As Workbook
Dim currentworkbook As Workbook

Set currentworkbook = ThisWorkbook

Set sourceworkbook = Workbooks.Open("C:\Users\babar\OneDrive\Desktop\New Folder\DRR.xlsx")
sourceworkbook.Worksheets("Month Actual").Range("E58:AI58").Copy


currentworkbook.Activate
currentworkbook.Worksheets("Daily Pickup").Activate
currentworkbook.Worksheets("Daily Pickup").Range("V5:V34" & ActiveCell.Row).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

End Sub
 

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
Try using the Unpivot function within Power Query. It can be found on the Data Tab of the Ribbon and is called Get and Transform Data
Load your data to the PQ Editor. On the Transform Tab of the Editor, select Unpivot. Close and Load your file to an excel spreadsheet.
 
Upvote 0
might be, but you will need to wait for someone who believes that VBA is the way to go. Patience. I prefer the methodology I proposed.
 
Upvote 0

Forum statistics

Threads
1,216,135
Messages
6,129,075
Members
449,485
Latest member
greggy

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