LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Copying a sheet, but preserving the formulas

You could do your copy, then edit|links and change those links.

another alternative that I like is to change all the formulas to text
copy your stuff
paste your stuff
change all the text formulas back to formula formulas.
(in both worksheets!)

Option Explicit
Sub testme()

Dim WksToCopy As Worksheet
Dim WksToPaste As Worksheet

Set WksToCopy = Workbooks("book1.xls").Worksheets("sheet1")
Set WksToPaste = Workbooks("book2.xls").Worksheets("sheet2")

With WksToCopy
.Cells.Replace what:="=", replacement:="$$$$$$"
.Cells.Copy _
Destination:=WksToPaste.Range("a1")
.Cells.Replace what:="$$$$$$", replacement:="="
End With
WksToPaste.Cells.Replace what:="$$$$$$", replacement:="="

End Sub

Use some unique string that doesn't appear in your workbook!


Budget Programmer wrote:

Hello,

I have a "template" worksheet ACTUALS within a workbook called TEMPLATE.xls.
I need to copy the ACTUALS worksheet to other workbooks. The code executes
OK, but the formulas in the destination worksheet are changed to point to the
Template source workbook. I tried to do this manually, and I get the same
results (Destination formulas point back to the TEMPLATE.XLS workbook.

How can I copy it so that it doesn't point to the source workbook?

Many Thanks.
--
Programmer on Budget


--

Dave Peterson

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
formulas copying from sheet to sheet Troy[_2_] Excel Worksheet Functions 6 August 21st 09 06:57 PM
How to retain column width and formulas in copying a sheet smich Excel Discussion (Misc queries) 3 January 15th 09 03:55 PM
Preserving Formulas drwexcel Excel Discussion (Misc queries) 0 June 1st 05 05:23 PM
Copying formulas, formats, and sheet names across workbooks Kevin H. Stecyk[_2_] Excel Programming 7 August 22nd 04 09:50 PM
Copying Sheet with Formulas Ashok Kumar Excel Programming 4 May 3rd 04 11:26 AM


All times are GMT +1. The time now is 06:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"