Thanks mate...... It works
Harpreet Gujral On Mon, Mar 8, 2010 at 12:58 PM, rf1234 rf1234 <rfhyd1...@gmail.com> wrote: > Dear gurpreet > Have a look on following code. > > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > > Option Explicit > > Sub Copy() > Dim wb As Workbook > Dim ws As Worksheet > Set ws = ActiveSheet > Set wb = Workbooks.Open(Application.GetOpenFilename) > wb.Worksheets(1).Cells.Copy > ws.Range("A1").PasteSpecial > wb.Close > End Sub > > ''''''''''''i have declare variable wb to have a path of selected workbook > ''''''''''''or u can use open method *Example* > Workbooks.Open("C:\MyFolder\MyBook.xls") > > > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > > > Hope it will help > Happy to Help > :) > Shyam > > On Sun, Mar 7, 2010 at 2:15 PM, Harpreet Singh Gujral < > harpreetguj...@gmail.com> wrote: > >> Hi Group, >> >> I have to copy a range of cells from anotherworkbook to activeworkbook, >> without opening the workbook. >> >> Example: I have the activeworkbook present in >> C:\ Temp1\XXX\YYY\Book1.xls >> while the other workbook resides at the following >> C:\Temp2\XXX\YYY\Book2.xls >> >> I have to copy Contents of sheet2.xls, Cells A2:C40 into book1.xls[new >> sheet]. Would it be possible to do this while working on Book1.xls, without >> having to open Book2.xls. >> >> >> Please advise >> >> Thanks >> >> Harpreet Gujral >> >> >> >> -- >> >> ---------------------------------------------------------------------------------- >> Some important links for excel users: >> 1. Follow us on TWITTER for tips tricks and links : >> http://twitter.com/exceldailytip >> 2. Join our Facebook Group @ >> http://www.facebook.com/group.php?gid=287779555678 >> 3. Excel tutorials at http://www.excel-macros.blogspot.com >> 4. Learn VBA Macros at http://www.quickvba.blogspot.com >> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com >> >> To post to this group, send email to excel-macros@googlegroups.com >> >> <><><><><><><><><><><><><><><><><><><><><><> >> HELP US GROW !! >> >> We reach over 6,800 subscribers worldwide and receive many nice notes >> about the learning and support from the group.Let friends and co-workers >> know they can subscribe to group at >> http://groups.google.com/group/excel-macros/subscribe >> > > -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our Facebook Group @ http://www.facebook.com/group.php?gid=287779555678 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,800 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe