Copy File Formulas between Files w/o the link

P

PJ in CO

Is there a way to copy a Excel file with just formulas (not data) and apply
it to another file w/o the copied file link included? I have a program which
spits out a xls file for each data set generated and I'd like to manipulate
the data repeatedly for each file w/o having to generate the doggone formulas
each time. Thank you
 
G

Gary''s Student

Let's say we have two workbooks, Book1.xls and Book2.xls. Each has Sheet1.

Here is a trick for high speed. Rather than copying individual cells with
formulas, we copy the entire sheet and then remove the non-formulas. (only a
single copy/paste):

Sub copy_formula()
Set w1 = Workbooks("Book1")
Set w2 = Workbooks("Book2")
w1.Sheets("Sheet1").Cells.Copy w2.Sheets("Sheet1").Range("A1")

w2.Activate
Sheets("Sheet1").Activate

For Each r In ActiveSheet.UsedRange
If r.HasFormula Then
Else
r.Clear
End If
Next

End Sub
 
G

Gord Dibben

One method....

F5>Special>Formulas>OK

Edit>Replace

What: =

With: ^^^

Replace all.

Copy to the new workbook/worksheet and then reverse the process of Edit>Replace.


Gord Dibben MS Excel MVP


On Tue, 11 Dec 2007 15:54:01 -0800, PJ in CO <PJ in
 
P

PJ in CO

Gord Dibben said:
One method....

F5>Special>Formulas>OK

Edit>Replace

What: =

With: ^^^

Replace all.

Copy to the new workbook/worksheet and then reverse the process of Edit>Replace.


Gord Dibben MS Excel MVP


On Tue, 11 Dec 2007 15:54:01 -0800, PJ in CO <PJ in


Thank you Both for your reply - I haven't attempted the first method yet, but will when I attempt to automate the number crunching. The second method described worked just fine. Thank you again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top