Use END to select last row using a Macro?

Cosmos75

Active Member
Joined
Feb 28, 2002
Messages
359
How can I write a macro to select the last row with data and then go to the next row? I’ve tried to records a macro where I do that, but it just goes to the last row with data and then says “Range("A59").Select”, where A59 just so happens to be the next row in that case but it won’t work once I’ve added or deleted a data row.

THANKS!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Sub FindLastRow()
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Rows.
lastrow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
End If
EndofList = lastrow
Range("A1").Select
ActiveCell.Offset(EndofList, 1).Range("A1").Select

End Sub
 
Upvote 0
On 2002-03-06 14:05, Cosmos75 wrote:
How can I write a macro to select the last row with data and then go to the next row? I’ve tried to records a macro where I do that, but it just goes to the last row with data and then says “Range("A59").Select”, where A59 just so happens to be the next row in that case but it won’t work once I’ve added or deleted a data row.

THANKS!

This will do the trick:

Range("A65536").End(xlUp).Offset(1, 0).Select

Regards,
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,749
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top