Is there a formula to place a value into another cell?

  • Thread starter Thread starter chillynois
  • Start date Start date
C

chillynois

Is there a formula to place a value into another cell?

For example, can I have a formula in cell 'A2' that places the value
"AAA" into cell 'A1'?

Thanks!
 
chillynois,

Technically, you could come up with a UDF (user defined function) that could
accomplish this, but it is probably not a good idea. It is very similar to
coding a macro though.

I would suggest that you use an IF() function in A1, based on the results of
a formula in A2 to accomplish this.......something like:

=IF(A2="Some test condition","AAA","")

HTH,

Conan Kelly
 
Conan,

A user-defined function can't put anything into a cell, other than to return a value into
the formula in the cell that contains it. Calls to UDFs live in cell formulas. A sub (as
opposed to a function) could put stuff into a cell.

Both are considered macros. Either will give you the macro warning when you open a file
containing them. A function can't change a cell, but try putting
kill "book1.xls"
in a function, and it'll happily delete that file when the function is called from a cell.
Not useful, because the next time it appears in a cell, and gets calculated, it'll produce
an error value, because the file is no longer there.

--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
 
Earl Kiosterud said:
Conan,

A user-defined function can't put anything into a cell, other than to
return a value into the formula in the cell that contains it. Calls to
UDFs live in cell formulas. . . .
....

Technically, Conan is correct, though at the least he didn't mention that it
could only be done from a udf by spawning a separate process via Shell or
Windows API calls that would wait a short amount of time, then take control
of Excel via Automation using the equivalent of a GetObject call, and make
the changes to the other cells.

Not easy. Not robust. But possible.
 
Back
Top