ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying Sheets (https://www.excelbanter.com/excel-programming/288151-copying-sheets.html)

ianripping[_21_]

Copying Sheets
 
I have this code

Workbooks.Open Filename:=Range("C1").Value
Sheets("Sheet1").Select
Selection.Copy
ActiveWorkbook.Close SaveChanges:=False
Windows("Book1.xls").Activate
Sheets("Sheet2").Select
ActiveSheet.Paste

The cod looks at the path in C1 and opens the file listed there. I
then copies Sheet1 i that workbook. It should then paste it int
Book1.xls but doesm't.

Any ideas what's wrong

--
Message posted from http://www.ExcelForum.com


ianripping[_22_]

Copying Sheets
 
its ok i've done it again. I should do this before I post I know.

Workbooks.Open Filename:=Range("C1").Value
ActiveWindow.WindowState = xlNormal
Sheets("Sheet2").Select
Sheets("Sheet2").Copy Befo=Workbooks("Book1.xls").Sheets(1)
Sheets("Sheet1").Select
ActiveWindow.WindowState = xlMaximized

MsgBox ("Completed Copying")

End Su

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Copying Sheets
 
Maybe reading the answers you get would be a good thing too.

--
Regards,
Tom Ogilvy

"ianripping " wrote in message
...
its ok i've done it again. I should do this before I post I know.

Workbooks.Open Filename:=Range("C1").Value
ActiveWindow.WindowState = xlNormal
Sheets("Sheet2").Select
Sheets("Sheet2").Copy Befo=Workbooks("Book1.xls").Sheets(1)
Sheets("Sheet1").Select
ActiveWindow.WindowState = xlMaximized

MsgBox ("Completed Copying")

End Sub


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com