PDA

View Full Version : Solved: Finding last row of a column



SeanJ
08-07-2008, 06:17 AM
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.

Bob Phillips
08-07-2008, 06:33 AM
Is it the last row in a particular column, or the last last row of all columns.

SeanJ
08-07-2008, 06:34 AM
The column will always be D I am just want to find the last row of that column.

Bob Phillips
08-07-2008, 06:56 AM
With Worksheets("Sheet1")

LastRow = .Cells(.Rows.Count, "D").End(xlUp).Row
End With

SeanJ
08-07-2008, 07:09 AM
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.

SeanJ
08-07-2008, 07:15 AM
I got the answer Iwas looking for.

wbk.Sheets(I).Range("D65536").End(xlUp).Row

Thanks for the help.

Aussiebear
08-09-2008, 02:26 PM
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.

mdmackillop
08-09-2008, 05:40 PM
I got the answer Iwas looking for.

wbk.Sheets(I).Range("D65536").End(xlUp).Row

Thanks for the help.
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.