Relativity with a macro

M

Mary jane

If I create a macro to automatically print a total row, and then I manipulate
that row i.e. move it, add columns, whatever, will the macro adjust to all
changes and run correctly?

Thanks
 
A

Alan

No it won't unfortunately, if you tell it to print a defined area like A1:C1
it will do just that, you would have to manually change the code,
Regards,
Alan
 
M

M. Authement

No it will not. You will need to use a named range, Indirect, or Offset
(there may be other options as well, but one of those three should work).
 
J

Joel

Did you create a Sub or a Function? If you have only one value that is
returned, then it is best to use the Function rather than a sub. I would be
best if you had a function where you referenced the cell by passing them into
the functions as parameters. then everything would be updated as you changed
you spreadsheet.
 
A

Alan

That true of course, but as I understood the original question, it was can
you set up a code event which will change the ranges set in the code to
accommodate changes in the worksheet regarding altering the range it refers
to.
You cant in VB, and if you need to alter a named range then what's the
difference? It still won't change, you have to alter it manually,
Regards,
Alan.
 
Top