ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Formula Code (https://www.excelbanter.com/excel-programming/421866-copy-formula-code.html)

Nikki

Copy Formula Code
 
Can anyone please give me a code that copies the preceeding cell and inserts
the formula only into the selected cell?

JBeaucaire[_138_]

Copy Formula Code
 

Define "preceding cell". Give specific examples of source and target
cells.


--
JBeaucaire
------------------------------------------------------------------------
JBeaucaire's Profile: http://www.thecodecage.com/forumz/member.php?userid=73
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45556


Rick Rothstein

Copy Formula Code
 
Did you want an identical copy of the formula (same range references)...

Selection.Formula = Selection.Offset(, -1).Formula

Or did you want the range reference to update for their new location...

Selection.Offset(, -1).Copy Selection

--
Rick (MVP - Excel)


"Nikki" wrote in message
...
Can anyone please give me a code that copies the preceeding cell and
inserts
the formula only into the selected cell?



JLGWhiz

Copy Formula Code
 
Some people do not realize that this site is visited by users from many
different countries and that some read from right to left and some read
vertically. Even worse, preceding could infer the previously selected cell
which could be anywhere. But the OP probably means the one to immediately to
the left of the selection.

"JBeaucaire" wrote:


Define "preceding cell". Give specific examples of source and target
cells.


--
JBeaucaire
------------------------------------------------------------------------
JBeaucaire's Profile: http://www.thecodecage.com/forumz/member.php?userid=73
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45556



Nikki

Copy Formula Code
 
THis worked Thanks a bunch



"Rick Rothstein" wrote:

Did you want an identical copy of the formula (same range references)...

Selection.Formula = Selection.Offset(, -1).Formula

Or did you want the range reference to update for their new location...

Selection.Offset(, -1).Copy Selection

--
Rick (MVP - Excel)


"Nikki" wrote in message
...
Can anyone please give me a code that copies the preceeding cell and
inserts
the formula only into the selected cell?





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com