Macro to copy 1 row in excel, to multiple rows in another sheet

jlax34

New Member
Joined
Feb 18, 2015
Messages
26
I'm thinking this is something simple, but I can't seem to figure it out. My macro goes to a sheet to copy some data, and then I want to it to go to another sheet and paste that data on the next 14 available rows. I tried selecting a range and then pasting, but it would only paste in a single row. I've tried combining the range selection with the paste and still in a single row. How do I get this to paste in multiple times without creating a loop or iterative statement that does it 14 times?

Code:
With sht
    Range(Cells(Count1, "A"), Cells(Count1, "E")).Select
    Selection.Copy
    Sheetname = Cells(Count1, "D").Value
    Sheets(Sheetname).Activate
    LastRow = Range("D150000").End(xlUp).Row
    Range(Cells(LastRow + 1, "B"), Cells(LastRow + 14, "E")).PasteSpecial xlValues
      Application.CutCopyMode = False
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Nevermind! I was asking someone for help and they couldn't figure it out, but watching them sparked an idea. I went back and changed the range selection in my paste sheet from multiple rows/columns, but just a single column (Just B instead of B:E) and now it is working!
 
Upvote 0
How about
Code:
With Sht
    .Range("A" & Count1).Resize(, 5).Copy
    Sheetname = Cells(Count1, "D").Value
    Sheets(Sheetname).Activate
    LastRow = Range("D150000").End(xlUp).Row
    Range("B" & LastRow + 1).Resize(1 * 14, 5).PasteSpecial xlValues
      Application.CutCopyMode = False
   End With
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,243
Members
449,075
Latest member
staticfluids

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