copy and paste range in new other document

shewendavelaar

New Member
Joined
Feb 19, 2019
Messages
9
Hi,

I've been trying to copy a variable range of rows form one sheet to another. The other sheet already contains data so I've tryinging to append it with the count.row function.
This is what I have so far:

Lastrow = Worksheets("input").Cells(Rows.Count, 7).End(xlUp).Row




Worksheets("input").Range(Cells(2, 1), Cells(Lastrow, 19)).Select
Selection.Copy
Workbooks.Open ("H:\Team 4\Proxy Voting\Global Proxy Voting\Zwitserland\CSV converter\Database\Swiss Connect Enterprise.xlsx")
lastrow1 = Worksheets("Swiss_Connect_Enterprise").Cells(Rows.Count, 1).End(xlUp).Row
Lastrow2 = lastrow1 + Lastrow
Lastrow3 = lastrow1 + 1
Worksheets("Swiss_Connect_Enterprise").Range(Cells(Lastrow3, 2), Cells(Lastrow2, 19)).Paste
Windows("CSV file converter rek. nummers.xlsm").Activate

Can someone help me solve this problem?
 

Some videos you may like

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,297
Office Version
  1. 365
Platform
  1. Windows
As you haven't told us what the problem is, this is a guess.
Code:
   LastRow = Worksheets("input").Cells(Rows.Count, 7).End(xlUp).Row
   
   With Worksheets("input")
      .Range(.Cells(2, 1), .Cells(LastRow, 19)).Select
      Selection.Copy
   End With
   Workbooks.Open ("H:\Team 4\Proxy Voting\Global Proxy Voting\Zwitserland\CSV converter\Database\Swiss Connect Enterprise.xlsx")
   LastRow1 = Worksheets("Swiss_Connect_Enterprise").Cells(Rows.Count, 1).End(xlUp).Row
   LastRow2 = LastRow1 + LastRow
   Lastrow3 = LastRow1 + 1
   With Worksheets("Swiss_Connect_Enterprise")
      .Range(.Cells(Lastrow3, 2), .Cells(LastRow2, 19)).PasteSpecial
   End With
   Windows("CSV file converter rek. nummers.xlsm").Activate
 

Watch MrExcel Video

Forum statistics

Threads
1,108,954
Messages
5,525,877
Members
409,668
Latest member
mitunsLax

This Week's Hot Topics

Top