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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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,215,676
Messages
6,126,168
Members
449,296
Latest member
tinneytwin

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