How To Find The Next Row in Microsoft Excel 2010

In this article, you will learn how to find the next row using VBA.

 

Let us understand with an example:

Following is a snapshot of Sales Report wherein the next row after the last row can be identified as 11.
 
img1
 
In case the user is working on large amount of data & multiple workbooks then, it becomes harder to manually figure out; we need VBA code to help us.
 
Click on Developer tab

From Code group, select Visual Basic
 
img2
 
or press ALT + F11 shortcut key to launch VB Editor screen.

Click on Insert, and then on Module
 
img3
 
This will create new module.

Enter the following code in the Module

 

Sub NextRow()

NR = ThisWorkbook.Sheets(“Sheet1″).Cells(Rows.Count, 1).End(xlUp).Row + 1

MsgBox “The next row is “& NR

End Sub
 
img4
 
The result will be shown through Message Box
 
img5
 
In this way, you can get to know the next available row of the worksheet using VBA code & now, we can use this code in writing larger codes for automation purpose.
 
 

Users are saying about us...

  1. This is really a good excel tip. I was just trying to write something similar and found your example. Thank you for your excel tips!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On Youtube