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