Thread: Copy worksheet
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AlanW AlanW is offline
external usenet poster
 
Posts: 29
Default Copy worksheet

I would like to copy a worksheet from FileA to FileB by using the listed
code, but it is strange that the result is just the opposite; it copies FileB
to FileA. Could someone please help.

The codes are as follows:-

Sub test()
Dim wb As Workbook, ws As Worksheet

Set ws = ThisWorkbook.ActiveSheet
Set wb = Workbooks.Open("C\FileB.xls")

wb.Sheets(1).Range("A1").Copy
ws.Range("A!").PasteSpecial xlPasteValues

wb.Close Savechanges:=False
End Sub


Thanks