PC Review


Reply
Thread Tools Rate Thread

automatic copy worksheet to anotehr workbook

 
 
John Keith
Guest
Posts: n/a
 
      16th Jun 2007
Every time that I open the file "temperature.xls" I would like to have
the worksheet "survey" contained "raw_data.xls" copied in to the
worksheet "baseline" (contained in "temperature.xls"). Both files are
in the same directory. I've thought about having formulas in each cell
in the target worksheet but this will not copy the formats which I
would like to maintain. I think a macro can probably do this and have
tried to record a macro (shown below with different file names to
test):


Sub Macro2()
'
' Macro2 Macro
' Macro recorded 6/15/2007 by John Keith
'

'
Windows("source.xls").Activate
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Sheet1").Select
ActiveWorkbook.Close
ChDir "C:\Copy"
Workbooks.Open Filename:= _
"C:\Copy\source.xls"
Sheets("Sheet1").Select
Sheets("Sheet1").Move Before:=Workbooks("target.xls").Sheets(1)
End Sub

But using the record process I am only able to get the worksheet
inserted in fromt of Sheet1 rather than replacing sheet1. What do I
need to change in the code to get it to replace the sheet rather than
inserting in front of it?

Also, it appears with the above code the source workbook does not have
to be open to copy the worksheet I'm interested in. Is that correct?

Do I have to do anything to automatically invoke the macro when the
file is opened?

And finally, can the window that asks whether the macro should be
disabled or enabled be removed so that it is not seen when the file is
opened?

Thanks for the advice!


John Keith
(E-Mail Removed)
 
Reply With Quote
 
 
 
 
John Keith
Guest
Posts: n/a
 
      18th Jun 2007
On Fri, 15 Jun 2007 21:08:57 -0600, John Keith <(E-Mail Removed)> wrote:

I've learned how to name my macro Auto_Open to get it to run when I
open the spreradsheet so I've learned that technique.

But I'm still seeking an answer on how to replace the target worksheet
rather than inserting in front of the first worksheet. Any
suggestions?

>But using the record process I am only able to get the worksheet
>inserted in fromt of Sheet1 rather than replacing sheet1. What do I
>need to change in the code to get it to replace the sheet rather than
>inserting in front of it?


John Keith
(E-Mail Removed)
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy cell value from one worksheet to matching worksheet in another workbook rech Microsoft Excel Programming 4 29th Sep 2011 03:02 PM
Copying range of formulas to anotehr workbook Brad P Microsoft Excel Discussion 4 19th May 2011 03:14 PM
Copy Excel Worksheet to new Workbook via VBA without Links to original Workbook JamesDMB Microsoft Access Form Coding 0 21st Mar 2007 06:13 PM
Copy Data from Workbook into specific Worksheet in other Workbook? kingdt Microsoft Excel Misc 1 16th Mar 2006 06:55 PM
copy worksheet from closed workbook to active workbook using vba =?Utf-8?B?bWFuZ28=?= Microsoft Excel Worksheet Functions 6 9th Dec 2004 07:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:01 PM.