ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macros and cells (https://www.excelbanter.com/excel-programming/348366-macros-cells.html)

frustrated

macros and cells
 

If I copy a cell that contains a macro, will the macro also be copied
across and the cell reference altered ie the same as a worksheet
function would be?

If not is there a way to do this?


--
frustrated
------------------------------------------------------------------------
frustrated's Profile: http://www.excelforum.com/member.php...o&userid=27778
View this thread: http://www.excelforum.com/showthread...hreadid=494331


Gary''s Student

macros and cells
 
How did you you put the macro in the cell?
--
Gary's Student


"frustrated" wrote:


If I copy a cell that contains a macro, will the macro also be copied
across and the cell reference altered ie the same as a worksheet
function would be?

If not is there a way to do this?


--
frustrated
------------------------------------------------------------------------
frustrated's Profile: http://www.excelforum.com/member.php...o&userid=27778
View this thread: http://www.excelforum.com/showthread...hreadid=494331



David

macros and cells
 
What does this macro do? What are you trying to accomplish? You will have to
provide us with some more detail. Generally formulas are copied to cells, not
macros.
--
David


"frustrated" wrote:


If I copy a cell that contains a macro, will the macro also be copied
across and the cell reference altered ie the same as a worksheet
function would be?

If not is there a way to do this?


--
frustrated
------------------------------------------------------------------------
frustrated's Profile: http://www.excelforum.com/member.php...o&userid=27778
View this thread: http://www.excelforum.com/showthread...hreadid=494331



JMay

macros and cells
 
a cell doesn't contain a macro, it can contain a function, however.
A functions first character must be the "=" (without the quote marks (though
excel does allow the Lotus users the
convenience of using the + and the - )
By default all cells (for copying and pasting purposes) are set to Relative.
There is another setting call Absolute, whch uses the "$" to Anchor a cell
reference (disallowing a change to it on Copy/paste)
In a function where cell references are used, example
A1...
can be
$A1 << Column A will remain fixed upon being copied/pasterd
A$1 << Row 1 will remain fixed upon being copied/pasted
$A$1 << A1 will retain its position (A1) upon being pasted.

In edit mode - click inside a single cell reference and press the F4 key, do it
again, and again.
Each time you will see excel circulate making the relative/absolute change..

Hope this helps..


"frustrated" wrote in
message ...

If I copy a cell that contains a macro, will the macro also be copied
across and the cell reference altered ie the same as a worksheet
function would be?

If not is there a way to do this?


--
frustrated
------------------------------------------------------------------------
frustrated's Profile:
http://www.excelforum.com/member.php...o&userid=27778
View this thread: http://www.excelforum.com/showthread...hreadid=494331




frustrated

macros and cells
 

My macro is not contained in a cell. Sorry my mistake.

What I meant was I have a macro that enters something into a specifi
cell. Now if I copy or cut that cell to another location will the cod
also change or will I have to edit it?

The reason I'm asking is that I have about 30 cells and I dont reall
want to have to alter code for each one.


Thanks for your hel

--
frustrate
-----------------------------------------------------------------------
frustrated's Profile: http://www.excelforum.com/member.php...fo&userid=2777
View this thread: http://www.excelforum.com/showthread.php?threadid=49433


JMay

macros and cells
 
It depends on how you are referring to the "cells" in your code. If your using
Range("A1"), or the like then the answer to your question is NO Moving A1
will not change the code.. it will still show Range("A1").

If you have used RangeNames, that's a different story
In your Code Range("MyRange1") then Your code
and your spreadsheet will stay IN SYNC.

HTH


f in your code you
"frustrated" wrote in
message ...

My macro is not contained in a cell. Sorry my mistake.

What I meant was I have a macro that enters something into a specific
cell. Now if I copy or cut that cell to another location will the code
also change or will I have to edit it?

The reason I'm asking is that I have about 30 cells and I dont really
want to have to alter code for each one.


Thanks for your help


--
frustrated
------------------------------------------------------------------------
frustrated's Profile:
http://www.excelforum.com/member.php...o&userid=27778
View this thread: http://www.excelforum.com/showthread...hreadid=494331





All times are GMT +1. The time now is 11:55 AM.

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