ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Copy a worksheet from a workbook (https://www.excelbanter.com/excel-worksheet-functions/208249-copy-worksheet-workbook.html)

BRABUS[_4_]

Copy a worksheet from a workbook
 

Ok I am sure this has been covered a million times but I am struggling
to find something that will help me so I appologise up front.

I am working with XL 2003 SP3 and have a spreadsheet (lets say its
called "ORIGINAL") that is open and running a macro. During this macro
I would like it to open another spreadsheet (lets say its called
"SECONDARY") and copy a worksheet called "Sheet1" and then paste it
back into the "ORIGINAL" spreadsheet.

I have tried various methods and get constantly changing results. Does
anyone have any very simple code PLEEEEEEEEEASE.




--
BRABUS

Don Guillett

Copy a worksheet from a workbook
 
The macro recorder is your friend. Try it and then post back with questions.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"BRABUS" wrote in message
...

Ok I am sure this has been covered a million times but I am struggling
to find something that will help me so I appologise up front.

I am working with XL 2003 SP3 and have a spreadsheet (lets say its
called "ORIGINAL") that is open and running a macro. During this macro
I would like it to open another spreadsheet (lets say its called
"SECONDARY") and copy a worksheet called "Sheet1" and then paste it
back into the "ORIGINAL" spreadsheet.

I have tried various methods and get constantly changing results. Does
anyone have any very simple code PLEEEEEEEEEASE.




--
BRABUS



BRABUS[_5_]

Copy a worksheet from a workbook
 

I have re-recorded a macro to do the copying, but when I run the macro
using a keyboard shortcut it stops once it opens the Secondary.MHTML
file


This is the macro

Sub OpenWorkbookAndCopySheet()
'
' OpenWorkbookAndCopySheet Macro
'
' Keyboard Shortcut: Ctrl+Shift+T
'
Workbooks.Open Filename:="C:\Secondary.MHTML"
Cells.Select
Range("C1").Activate
Selection.Copy
Windows("Original.xls").Activate
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
Windows("Secondary.MHTML").Activate
ActiveWindow.Close
Range("A1").Select
Sheets("Sheet1").Select


End Sub




--
BRABUS


All times are GMT +1. The time now is 02:09 PM.

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