Finding the last row entered

S

Steved

Hello from Steved

Please in Column A how do i find the last row with data
using a macro.

At the moment I'm on Row 1108 so can a macro find the next
row in this case 1109 biut by tonight I'll be on row 1150,
so in this case would it goto row 1151.

Thankyou Very Much.
 
R

Ron de Bruin

Hi Steved

You can use this to select the next empty cell

Sub test()
Range("A" & Rows.Count).End(xlUp)(2).Select
End Sub

This will select the last cell with data
Range("A" & Rows.Count).End(xlUp).Select
 
A

Alan Perkins

Assuming the data's in sheet1, this will return the next empty cell in
column A

ThisWorkbook.Sheets("Sheet1").Range("A65536").End(xlUp).Offset(1, 0)

HTH

Alan P.
 
T

Trevor Shuttleworth

Steve

' note that NextRow will be 2 if no data is present
Dim NextRow As Long
NextRow = Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row
MsgBox NextRow

Regards

Trevor
 
J

Jason Morin

Sub LastCell()
Dim LastCellRow As Long
Dim FirstOpenRow As Long
LastCellRow = Cells(Rows.Count, "A").End(xlUp).Row
FirstOpenRow = LastCellRow + 1
MsgBox FirstOpenRow
End Sub
 

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