View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Paul Paul is offline
external usenet poster
 
Posts: 21
Default Need a macro to copy a range in one workbook and paste into another workbook

Thanks for your efforts Samura.
I still see errors for some reason, with your code.
It cannot find "ITHD Monthly Calculator for reports V5.xls",
I overcome this, then it comes up with Compile error on the SAVE.

Maybe the differences are due to Excel Versions. I'm on XL 2K SR-1

Thanks again for the trouble.

Cheers Paul

"Samura" wrote in message ...
Hi.
It may be late, I fixed that macro.
This macro does not receive the error.
The macro opens the book "ITHD Monthly Calculator for reports V5.xls",
and pastes from "ITHD Reports.xls" to the book, and saves the book,
and closes the book.


Sub ITHDdocID()

Dim rng As Range
Dim pastedBook As Workbook

Windows("ITHD Reports.xls").Activate

Worksheets("ITHD").Range("A6").Select

'selected from ITHD!A6 to the end
Set rng = Range(Selection, Selection.End(xlDown))
rng.Select
rng.Copy

'opened the book "ITHD Monthly Calculator for reports V5.xls"
Set pastedBook = Workbooks.Open("ITHD Monthly Calculator for reports
V5.xls")

'pasted to Time!A3
pastedBook.Worksheets("Time").Range("A3").PasteSpe cial xlPasteValues

'saved the book "ITHD Monthly Calculator for reports V5.xls"
pastedBook.Save

'closed the book "ITHD Monthly Calculator for reports V5.xls"
pastedBook.Close
Set pastedBook = Nothing

End Sub


--
Samura


"Paul" wrote in message
om...
Thanks for you help Samura,
But I receive an error on running the code.
"Subscript out of range"
on the line :"Windows("ITHD Monthly Calculator for reports

V5.xls").Activate"

But anyway I have found a solution.

So Once again Thank you very much