View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default 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