Need a macro that selects the "next" cell in a column

vangogh228

Registered User.
Local time
Yesterday, 23:04
Joined
Apr 19, 2002
Messages
302
I am trying to run a Do-Loop macro that copies a cell's value and pastes it at the bottom of a column until a certain condition is met. To find the first available cell, I can click at the top of the column, then do END-DOWN then a down arrow. BUT... I cannot seem to get macrocode to recognize my down arrow as a movement in that direction. It always gives me an absolute address ("N22") or the like.

How do I get it to recognize I want to GO DOWN ONE from wherever the previous END-DOWN put it? I cannot find the correct command to do this!!

Thanks for any help!!
 
Howdy. It is usually better to go UP than DOWN, in case there are empty cells. Try this (assumes your column is N = 14):

Code:
Sub test()
    Dim lngLastRow As Long
    lngLastRow = Range("N" & Rows.Count).End(xlUp).Row
    Cells(lngLastRow + 1, 14).Select
End Sub

If you want to use the down method, then:

Code:
Sub test()
    Dim lngLastRow As Long
    lngLastRow = Range("N1").End(xlDown).Row
    Cells(lngLastRow + 1, 14).Select
End Sub
________
FORD PARKLANE HISTORY
 
Last edited:
Hi, Matt,

if you don´t need the number of the line for other cases (I´m quite sure that shades agrees that it´s unnecessary to select a cell as almost all actions may take place without selection):

Code:
Sub UseNoVariables1()
Cells(Cells(Rows.Count, "N").End(xlUp).Row + 1, "N").Select
End Sub

Sub UseNoVariables2()
Cells(Cells(1, "N").End(xlDown).Row + 1, "N").Select
End Sub
Ciao,
Holger
 

Users who are viewing this thread

Back
Top Bottom