Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy a sheet from a workbook to another in different folder
Happy Holloween!
I'd like to copy in VBA a sheet from one workbook to another workbook that is located in different folder. Thanks! Kurt |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy a sheet from a workbook to another in different folder
This also copies a range from one book to the other but it should work for
you with a little tweaking... Sub Test() Dim wbkSource As Workbook Dim wbkDestination As Workbook Dim wksSource As Worksheet Dim wksDestination As Worksheet Dim rngSource As Range Dim rngDestination As Range 'Set your source Set wbkSource = ThisWorkbook Set wksSource = wbkSource.Sheets("Sheet1") Set rngSource = wksSource.Cells 'Set your destination On Error GoTo OpenBook Set wbkDestination = Workbooks("ThatBook.xls") On Error GoTo 0 Set wksDestination = wbkDestination.Sheets("Sheet1") Set rngDestination = wksDestination.Range("A1") 'You now have all of your souce and destination objects wksSource.Copy wksDestination 'Copy the sheet rngSource.Copy rngDestination 'Copy a range Exit Sub OpenBook: Set wbkDestination = Workbooks.Open("C:\Thatbook.xls") Resume Next Exit Sub End Sub -- HTH... Jim Thomlinson "kurt" wrote: Happy Holloween! I'd like to copy in VBA a sheet from one workbook to another workbook that is located in different folder. Thanks! Kurt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to Copy Excel Workbook - Hyperlinks - Folder of Photos - to CD | Excel Worksheet Functions | |||
How to Copy Excel Workbook - Hyperlinks - Folder of Photos - to CD | Excel Worksheet Functions | |||
move a sheet out of my workbook and place in another folder? | Excel Discussion (Misc queries) | |||
Open and copy all workbook sheets in a folder to a master file | Excel Discussion (Misc queries) | |||
HELP: Link all values in a workbook under same folder on one sheet | Excel Programming |