Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
can VBA be used to append rows of data from sheet2 from "day.xls" to the last row of the data in sheet1 of the "hours.xls"? many thanks. regards, Joe |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Are both files open Joe or one of the two -- Regards Ron de Bruin http://www.rondebruin.nl "Joe" wrote in message ... Hi, can VBA be used to append rows of data from sheet2 from "day.xls" to the last row of the data in sheet1 of the "hours.xls"? many thanks. regards, Joe |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I actually gt one file: name.xls that contains sheet1 and sheet2 and i am using the button to generate a new file call: Book1.xls, copy the data from sheet1 of the name.xls and paste to sheet1 of the Book1.xls.This is followed by copy and paste the data from sheet2 of the name.xls to the last row of the data that has been pasted (data copy and pasted to sheet1 of the Book1.xls). regards, Joe -----Original Message----- Hi Are both files open Joe or one of the two -- Regards Ron de Bruin http://www.rondebruin.nl "Joe" wrote in message ... Hi, can VBA be used to append rows of data from sheet2 from "day.xls" to the last row of the data in sheet1 of the "hours.xls"? many thanks. regards, Joe . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joe
If i understand you correct then this will work for you You can use this two line if yoyu want to save the file and close it 'wb2.SaveAs "C:\test2.xls 'wb2.Close False Sub test() Dim wb1 As Workbook Dim wb2 As Workbook Set wb1 = ActiveWorkbook Set wb2 = Workbooks.Add(1) wb1.Sheets(1).UsedRange.Copy wb2.Sheets(1).Range("A1") wb1.Sheets(2).UsedRange.Copy wb2.Sheets(1).Range("A" & _ wb2.Sheets(1).UsedRange.Rows.Count + 1) 'wb2.SaveAs "C:\test2.xls 'wb2.Close False Set wb1 = Nothing Set wb2 = Nothing End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Joe" wrote in message ... Hi, I actually gt one file: name.xls that contains sheet1 and sheet2 and i am using the button to generate a new file call: Book1.xls, copy the data from sheet1 of the name.xls and paste to sheet1 of the Book1.xls.This is followed by copy and paste the data from sheet2 of the name.xls to the last row of the data that has been pasted (data copy and pasted to sheet1 of the Book1.xls). regards, Joe -----Original Message----- Hi Are both files open Joe or one of the two -- Regards Ron de Bruin http://www.rondebruin.nl "Joe" wrote in message ... Hi, can VBA be used to append rows of data from sheet2 from "day.xls" to the last row of the data in sheet1 of the "hours.xls"? many thanks. regards, Joe . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Assuming you want all the data in day.xls to be appended
to hours.xls and the data is contiguous (no blank rows or columns) in the day.xls file: Workbooks("day.xls").Activate Range("A1").CurrentRegion.Copy 'Copies the data Workbooks("hours.xls").Activate Range("A65536").End(xlUp).Select 'Selects the bottom row ActiveCell.Offset(1, 0).Paste 'Pastes to the next empty row -----Original Message----- Hi, can VBA be used to append rows of data from sheet2 from "day.xls" to the last row of the data in sheet1 of the "hours.xls"? many thanks. regards, Joe . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
COPY / APPEND` | Excel Worksheet Functions | |||
How do you append one row to another? | Excel Worksheet Functions | |||
Append worksheets together in one | Excel Discussion (Misc queries) | |||
Compare and Append | Excel Programming |