View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Need macro to move to first blank cell in column

What you are doing is a mix of Relative and Staic references. You can record
a mocro that will do this but it is tricky. Oddly enough it is much easier to
write from scratch.

If you want to record the macro then Before you do the down arro operation
followed by the subsequent down arrow, first select the relative opton on the
Stop recording tool bar. This makes your movements relative to the active
cell and not absolute. To complete this macro you will have to switch it on
and off fairly often and plan on getting it wrong more than once...

Written from scratch it will look something like this...

Sub CopyStuff()
dim rngToPaste as range

set rngtopaste = cells(rows.count, "A").end(xlup).offset(1,0)
'rngtopaste is now at the first blank cell in column A
sheets("Sheet1").Range("C1").copy rngtopaste 'paste in A
Sheets("Sheet2").range("D100").copy rngtopaste.offset(0,1) 'Paste in B
rngtopaste.offset(-1, 2).copy rngtopste.offset(0,2) 'Paste in C

end sub
--
HTH...

Jim Thomlinson


"Joe M." wrote:

Hi. I am trying to use a macro to move from A1 to the first blank cell in col
A. There are no gaps in the data. When the first blank cell is selected, data
will be copied and pasted from another worksheet. Then the adjacent cell in
col B must be selected and again data will be copied and pasted there from
another worksheet. Finally, the adjacent cell in col C must be selected but
the formula from the cell above must be extended down one cell. I have
recorded a macro which does all this but the problem is that when I repeat
the macro the same row is always selected instead of the next blank one. Here
are the steps I did while recording the macro:
1 .Select & copy A1
2.Press <cntl + <end (this brings me to last filled cell in col C)
3. Press down arrow key 1 time and left arrow key 2 times to move to 1st
blank cell in col A.
4. Paste in col A blank cell
5. Copy cell from other worksheet (always the same cell #)
6. Select original worksheet. Press right arrow key once to move to col B.
7. Paste in col B blank cell
8. Press right arrow once and up arrow once to move to last filled cell in
col C.
9. Extend the formula down one cell in col C.
Now the previous 3 blank cells in col A, B & C are filled. But when I
repeat the macro the same cells are filled, not one down each time. Can
someone help?

Thanks,
Joe M.