#1   Report Post  
Posted to microsoft.public.excel.programming
joe joe is offline
external usenet poster
 
Posts: 62
Default append row

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default append row

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   Report Post  
Posted to microsoft.public.excel.programming
joe joe is offline
external usenet poster
 
Posts: 62
Default append row

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default append row

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default append row

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
COPY / APPEND` jon Excel Worksheet Functions 0 February 10th 09 03:26 PM
How do you append one row to another? BobVanS Excel Worksheet Functions 3 August 30th 07 02:04 PM
Append worksheets together in one bioyyy Excel Discussion (Misc queries) 1 October 14th 05 07:10 AM
Compare and Append BFord Excel Programming 2 January 3rd 04 05:15 AM


All times are GMT +1. The time now is 03:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"