![]() |
Copy formulas via Code
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? |
Copy formulas via Code
One way:
Sheets("work").Range("a1:b10").FormulaR1C1 _ = Sheets("database").Range("d1:e10").FormulaR1C1 Another way is to copy|paste special|formulas Cordobes wrote: 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? -- Dave Peterson |
All times are GMT +1. The time now is 08:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com