copy from 1 sheet into another?
Hi, can anyone assist me with the following. I have 2 files: \server1\data\cumulative.xls (file 1) and \reports\updates\report.xls (file 2) The data in file 1 looks like this: A5:X193 which will increase by extra rows when extra data is entered. And row 5 is the header row. I would like to automatically copy the data in columns C,D, E,K &,M o worksheet "data" of \server1\data\cumulative.xls INTO B,C,D,E,F of worksheet "report" of \reports\updates\report.xls The paste would start at row 484 of reports.xls each time as it woul be a complete refresh of the current data. Let me know if any of this doesnt make sense, and thanks for anyone help !! love, Amy x -- AmyTaylo ----------------------------------------------------------------------- AmyTaylor's Profile: http://www.excelforum.com/member.php...fo&userid=2097 View this thread: http://www.excelforum.com/showthread.php?threadid=38930 |
copy from 1 sheet into another?
Hi,
Try this which assumes both workbooks are active (open). Code is in "Cumulative.xls" but could be in Personal.xls. It assumes input date finishes in LR of column D ie.e all rows are same length and header row is NOT copied. Change 6 to 5 if header row required. Option Explicit Sub DataToReport() ' Dim wb As Workbook Dim rng As Range Dim lr As Long Windows("cumulative.xls").Activate With Worksheets("Data") lr = .Cells(Rows.Count, "D").End(xlUp).Row Set rng = .Range("C6:E" & lr) Set rng = Union(rng, .Range("K6:K" & lr)) Set rng = Union(rng, .Range("M6:M" & lr)) End With Set wb = Workbooks("Report.xls") rng.Copy wb.Worksheets("Report").Range("B484") End Sub HTH "AmyTaylor" wrote: Hi, can anyone assist me with the following. I have 2 files: \server1\data\cumulative.xls (file 1) and \reports\updates\report.xls (file 2) The data in file 1 looks like this: A5:X193 which will increase by extra rows when extra data is entered. And row 5 is the header row. I would like to automatically copy the data in columns C,D, E,K &,M of worksheet "data" of \server1\data\cumulative.xls INTO B,C,D,E,F of worksheet "report" of \reports\updates\report.xls The paste would start at row 484 of reports.xls each time as it would be a complete refresh of the current data. Let me know if any of this doesnt make sense, and thanks for anyones help !! love, Amy xx -- AmyTaylor ------------------------------------------------------------------------ AmyTaylor's Profile: http://www.excelforum.com/member.php...o&userid=20970 View this thread: http://www.excelforum.com/showthread...hreadid=389301 |
copy from 1 sheet into another?
Hi Toppers, thanks for your help, the code works great !! Thanks again, lots of love Amy -- AmyTaylo ----------------------------------------------------------------------- AmyTaylor's Profile: http://www.excelforum.com/member.php...fo&userid=2097 View this thread: http://www.excelforum.com/showthread.php?threadid=38930 |
copy from 1 sheet into another?
Hi Everyone, sorry to disturb, but when I run this, I get subscript out of range, can anyone help please ?! Thanks Amy -- AmyTaylor ------------------------------------------------------------------------ AmyTaylor's Profile: http://www.excelforum.com/member.php...o&userid=20970 View this thread: http://www.excelforum.com/showthread...hreadid=389301 |
All times are GMT +1. The time now is 05:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com