ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data Mover (https://www.excelbanter.com/excel-programming/418051-data-mover.html)

Mark J

Data Mover
 
I have a spreadsheet that i need to add data from another spreadsheet daily.
Is there a way using vb that i can copy data from one spreadsheet to another,
but have the data go to the last row..

ie if i copy data to the first 20 rows, then the next day i need to copy new
data starting at row 21, and so forth each day.

I would really like to do this using vba. Thanks

Chip Pearson

Data Mover
 
Try something along the lines of the following:

Sub AAA()
Dim WB1 As Workbook
Dim WB2 As Workbook
Dim LastRow As Long
Set WB1 = Workbooks("FromBook.xls") ' source workbook
Set WB2 = Workbooks("ToWorkbook.xls") ' destination workbook
' change destination sheet name below
With WB2.Worksheets("SheetName")
' change column letter below
LastRow = .Cells(.Rows.Count, "C").End(xlUp)(2, 1).Row
' change source sheet name and row number
WB1.Worksheets("FromSheet").Rows(100).Copy _
Destination:=.Cells(LastRow, "A")
End With
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
The San Diego Project Group, LLC
(email is on the web site)
USA Central Daylight Time (-5:00 GMT)


On Fri, 3 Oct 2008 08:49:03 -0700, Mark J
wrote:

I have a spreadsheet that i need to add data from another spreadsheet daily.
Is there a way using vb that i can copy data from one spreadsheet to another,
but have the data go to the last row..

ie if i copy data to the first 20 rows, then the next day i need to copy new
data starting at row 21, and so forth each day.

I would really like to do this using vba. Thanks



All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com