Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I copy a worksheet form a workbook in my workbook
Hi am using the following code to open a workbook sFileName = Application.GetOpenFilename If sFileName = "False" Then Exit Sub Workbooks.Open sFileName I need to copy sheet2 from the open workbook into the workbook that is running the above code. Also another thought if the workbook mentioned above is already open what is the code to stop an error showing and activating the open workbook? Many Thanks Neil *** Sent via Developersdex http://www.developersdex.com *** |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I copy a worksheet form a workbook in my workbook
Hello -
The following will check whether an Excel file called aName is already open ... For Each lWorkbook In Workbooks If lWorkbook.Name = aName Then lResult = MsgBox(aName & " is already open") ... End If Next lWorkbook The next code snippet will copy the specified Worksheet into a new workbook and save it ... ThisWorkbook.Sheets("Sheet1").Select ThisWorkbook.Sheets("Sheet1").Copy ActiveWorkbook.SaveAs Filename:="C:\X.xls", FileFormat:=xlNormal Joe |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy worksheet from one workbook to a master workbook | Excel Worksheet Functions | |||
Copy Worksheet from one Workbook to another Workbook | Excel Discussion (Misc queries) | |||
Copy Data from Workbook into specific Worksheet in other Workbook? | Excel Discussion (Misc queries) | |||
copy worksheet from closed workbook to active workbook using vba | Excel Worksheet Functions | |||
Copy VBA Module and Form from Workbook to another workbook | Excel Programming |