Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Copying formulas to new cell

Cells(cRow, 10).FormulaR1C1 = Cells(cRow - 1, 10).FormulaR1C1

is one way to do it.

As to which is the "best" way, it depends. PasteSpecial is very useful for a
lot of formulas. For one offs, I prefer the above.


"Ed Bitzer" wrote in message
...
To copy a formula (with smart adjustment for the new location) from cRow
4 to cRow 5 where cRow = 5 I can use:
ActiveSheet.Cells(cRow - 1, 10).Copy
ActiveSheet.Cells(cRow, 10).PasteSpecial Paste:=xlPasteFormulas
Is this the "best" way?
I am surprised that this:
Cells(cRow, 10).Formula = Cells(cRow - 1, 10).Formula
does not work. It copies the formula but without adjustment for the new
location.

Ed




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copying formulas to new cell

That's clever.

--
Regards,
Tom Ogilvy

Tim Zych wrote in message
...
Cells(cRow, 10).FormulaR1C1 = Cells(cRow - 1, 10).FormulaR1C1

is one way to do it.

As to which is the "best" way, it depends. PasteSpecial is very useful for

a
lot of formulas. For one offs, I prefer the above.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Copying formulas to new cell

Thanks. The original inspiration for this approach was provided by John
Green and Vasant Nanavati during a discussion a while back. Just to add,
FormulaR1C1 is the only (non paste special) way I know of that can properly
assign noncontiguous formulas in one action:

Range("A6, A10, A12").FormulaR1C1 = Range("A3").FormulaR1C1

Tim

"Tom Ogilvy" wrote in message
...
That's clever.

--
Regards,
Tom Ogilvy

Tim Zych wrote in message
...
Cells(cRow, 10).FormulaR1C1 = Cells(cRow - 1, 10).FormulaR1C1

is one way to do it.

As to which is the "best" way, it depends. PasteSpecial is very useful

for
a
lot of formulas. For one offs, I prefer the above.






Reply
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
Copying formulas from one cell to another Woodie6 Excel Worksheet Functions 7 October 24th 09 04:50 PM
Copying cell formulas D.Robison Excel Discussion (Misc queries) 0 October 13th 09 12:44 AM
copying formulas and changing cell references mainsol Excel Discussion (Misc queries) 3 February 9th 09 09:42 AM
Copying Cell Results, Not Formulas, Between Worksheets clouts Excel Worksheet Functions 2 September 30th 08 09:04 PM
copying formulas to another cell greg Excel Worksheet Functions 2 August 24th 05 08:51 PM


All times are GMT +1. The time now is 08:54 AM.

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

About Us

"It's about Microsoft Excel"