Starting position for a macro

  • Thread starter Thread starter Hilda
  • Start date Start date
H

Hilda

I'm writing a macro to automate the copying of data from
one file to another. I'm not writing code, but using
Excel "Record Macro". Is there any keystroke I can use
that will be recorded that looks for the next blank line
in the sheet I'm copying the data to. I've tried "End"
and arrow down key but it keeps going to that particular
cell even if I've added data.
Help

Hilda
 
Hi Hilda,
When you record a macro you are referring to specific cells
at the time you recorded the macro. There is a relative reference
button on the right of the "Stop Recording" toolbar.

Also rather than going to the first empty cell in a column, you
might be better off going the beginning of the empty cells
after your data in Column A, by finding the first non empty cell
from the bottom and then adjusting down one row.

Cells(Rows.Count, ActiveCell.Column).End(xlUp).Offset(0,1).Select

Of course you really want to avoid actually selecting a cell

Some helpful hints to writing efficient macros can be found in
http://www.mvps.org/dmcritchie/excel/proper.htm
the piece of code above was modified from something by Tom Ogilvy in
http://www.mvps.org/dmcritchie/excel/toolbars.htm
some hints for
 
Back
Top