Macro to go to next empty cell

J

Jeane

How would I write a macro to go to the next empty cell at
the bottom of a column? For example, I have numbers in
C2,C3 and C4. I want the macro to take the number from A1
and put it in C5, then I want to run the macro again and
put a number from A1 into C6, etc.
 
G

Gord Dibben

Jeane

Sub findbottom()
Range("a1").Copy Destination:= _
ActiveSheet.Cells(Rows.Count, 3).End(xlUp) _
.Offset(1, 0)
End Sub

Code will copy A1 to the first empty cell in Column C below data.

Gord Dibben XL2002
 
P

pfsardella

Assuming the first number is in cell C2. that cell C3 contains a
value, and that are no spaces in the column,

Range("C2").End(xlDown).Offset(1,0).Value = Range("A1").Value

HTH
Paul
 
J

Jeane

Thank you!
-----Original Message-----
Jeane

Sub findbottom()
Range("a1").Copy Destination:= _
ActiveSheet.Cells(Rows.Count, 3).End(xlUp) _
.Offset(1, 0)
End Sub

Code will copy A1 to the first empty cell in Column C below data.

Gord Dibben XL2002
 
J

Jeane

Thank you!
-----Original Message-----
Assuming the first number is in cell C2. that cell C3 contains a
value, and that are no spaces in the column,

Range("C2").End(xlDown).Offset(1,0).Value = Range ("A1").Value
----------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
---------------------------------------------------------- ----------------------------------------------------

.
 
D

David McRitchie

Hi Jeane,
For a more generic solution which takes you to the last cell with
content (not empty) in the column of the active cell, which I have
on a toolbar button
http://www.mvps.org/dmcritchie/excel/toolbars.htm#xl2kTBM .

Sub GotoBottomOfCurrentColumn()
'Tom Ogilvy 2000-06-26
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
End Sub

or the empty cell as you are looking for

Sub GotoBottomOfColumnA_PlusOne()
'Tom Ogilvy 2000-06-26
Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).Select
End Sub

Actually these are probably a closer fit to your question. The other
answers were addressed to the for example part and specifically
relate to column C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top