Jump to content

[EXCEL] Finding the last row


Recommended Posts

Problem solved.

What's the best solution to find the last empty row of an excel sheet.

I'm trying to add data to the bottom of a sheet but haven't yet found a realiable solution.

I've tried "Range(##).End"-trick but it seems unreliable sometimes.

Could some SQL-thingies come in picture??

Edited by amokoura
Link to comment
Share on other sites

This will work in VBA

Worksheets(<Sheetname>).Cells.Find(What:="*", SearchDirection:=xlPrevious, _ SearchOrder:=xlByRows).Row

This gves the row number. so to use have

Dim RowNum as Integer

RowNum = Worksheets(<Sheetname>).Cells.Find(What:="*", SearchDirection:=xlPrevious, _ SearchOrder:=xlByRows).Row

Edited by phkninja
Link to comment
Share on other sites

Thanks for the Find method! For some reason I didn't get the expected result but I found another solution. The method will come handy in other problems, thx!

Problem solved.

Edited by amokoura
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...