Macro to find the next free line

  • Thread starter Thread starter Madasu
  • Start date Start date
M

Madasu

I'm having trouble recording a macro that will find the next free line in a
column so I can append data.

What macro commands will in effect select a cell, end/down, down?

Any help appreciated
 
Milton --

See article - Identifying the Real Last Cell ...

www.beyondtechnology.com/geeks012.shtml


- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com




I'm having trouble recording a macro that will find the next free line in a
column so I can append data.

What macro commands will in effect select a cell, end/down, down?

Any help appreciated
 
Milton --

See article - Identifying the Real Last Cell ...

www.beyondtechnology.com/geeks012.shtml

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com


I'm having trouble recording a macro that will find the next free line in a
column so I can append data.

What macro commands will in effect select a cell, end/down, down?

Any help appreciated

Excellent Rodney. Many thanks. (I'm kicking myself for the simplicity of
bottom up!!

Thanks agran
 
Try this:

Range("A1").End(xlDown).Offset(1, 0).Select

or

Range("A65536").End(xlUp).Offset(1, 0).Selec
 
Excellent Rodney. Many thanks. (I'm kicking myself for the simplicity of
bottom up!!

Thanks agran

Sorry Rodney I'm still stuck. I'm pretty new to this and so the "even
better way" quoted in the article has me licked. However my real problem is
that the end up line will find the last row but I want the next blank row.
If I record the macro with end up (xlUp argument) and then the down key it
uses 'select' instad of moving to the line below the current selected cell.
Obviously no matter where xlUp take me the select argument won't vary.

I hope that's understandable.

Any ideas?

Thanks
 
To some extent, finding the 'last cell' in a column (or worksheet)
depends on one's definition of 'last cell.'

If you are satisfied with the xlUp approach for a particular column
(say, column A), a simple, though far from foolproof, method is
WKS.Cells(Rows.count,1).end(xlup).offset(1,0), where WKS is a variable
of type Worksheet.

For a more robust way to find the first empty cell in a column see
http://groups.google.com/groups?threadm=MPG.18fb24b0ef27ae0598aa86%
40msnews.microsoft.com

Of course, it still relies on a particular definition of 'empty.'

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

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

Back
Top