VB Command to move cursor to first empty row of table

I am recording an Excel macro and need it to select the first empty field at the bottom of a particular column.  The number of rows in the column will vary every time I run the macro.  

I've figured out a way to have the macro move to the last row of data of the column with this command:

Selection.End(xlDown).Select

If column F has 8 rows of data, the above lands me on F8.  But I then need to move the cursor down one more row to F9.  When I use the macro recorder, Excel records a literal address of F9 like this:

Range("F9").Select

But the next time I run it column F might have 10 rows of data.  What command do I use to move down one?
witzph1Asked:
Who is Participating?
 
NorieConnect With a Mentor VBA ExpertCommented:
Try this.
Range("F" & Rows.Count).End(xlUp).Offset(1).Select

Open in new window

0
 
FlysterCommented:
Try something like this:

I= Selection.End(xlDown).Select
Range("F"& I+1).Range

Flyster
0
 
witzph1Author Commented:
This gives does exactly what I need and does it in the most elegant fashion. Thank you!
0
 
FlysterCommented:
I agree. Nice code imnorie!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.