I am pulling data from another workbook, and I need to know the last row of any worksheet in that workbook. There will be empty row before that last row. I need to find the total number of rows of a sheet.
I am pulling data from another workbook, and I need to know the last row of any worksheet in that workbook. There will be empty row before that last row. I need to find the total number of rows of a sheet.
Is it the last row in a particular column, or the last last row of all columns.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
The column will always be D I am just want to find the last row of that column.
[vba]
With Worksheets("Sheet1")
LastRow = .Cells(.Rows.Count, "D").End(xlUp).Row
End With
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Sorry did not work. I am posting a example workbook with data populating sheet1. The last row will always be moving on every sheet in different workbooks.
I got the answer Iwas looking for.
wbk.Sheets(I).Range("D65536").End(xlUp).Row
Thanks for the help.
How does your solution do what you asked in your first post?
I am pulling data from another workbook, and I need to know the last row of any worksheet in that workbook. There will be empty row before that last row. I need to find the total number of rows of a sheet.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
That is what the reply in Post 4 does, when suitably qualified as per your example, but it will also work in Excel 2007 which can have rows greater than 65536.Originally Posted by SeanJ
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'