Copy formulas via Code

G

Guest

I have a range with formulas on sheet2 called "database". I want to get this
range and transfer it's contents to sheet1 called "work", but I want the
formulas to update themselves to this new location, and not show the same
exact formula that was found in the original range. I had tried :

sheets("work").range("a1:b10").formula =
sheets("database").range("d1:e10").formula

with the following results

Cells d1 to d10 on sheet database contain X values, and cells e1 to e10
contain the formula =d1*d1, =d2*d2, and so forth.

What I obtain on cells a1 to b10 on sheet work is exactly the same formulase
outlined above ( ie : = d1*d2 ) instead of the formula getting updated to =
a1*a1, = a2*a2.

I don't want to use the copy paste method because it changes the sheet
selection and I have code written for the activate and deactivate events on
each of these sheets.

Any suggestions?
 
D

Dave Peterson

One way:

Sheets("work").Range("a1:b10").FormulaR1C1 _
= Sheets("database").Range("d1:e10").FormulaR1C1

Another way is to copy|paste special|formulas
 

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