ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding the last row in a sheet in a closed workbook. (https://www.excelbanter.com/excel-programming/336650-finding-last-row-sheet-closed-workbook.html)

peterv[_2_]

Finding the last row in a sheet in a closed workbook.
 

I know there is a way to find the last used row in a spreadsheet, but
I'd like to know if there is any way to determine the last row used in
a range in a spreadsheet in a closed workbook.


--
peterv
------------------------------------------------------------------------
peterv's Profile: http://www.excelforum.com/member.php...o&userid=25572
View this thread: http://www.excelforum.com/showthread...hreadid=393787


Tom Ogilvy

Finding the last row in a sheet in a closed workbook.
 
Depends on what the data looks like, but if there will be no blanks inside a
column of data

=countA(C:\myfolder\[Myfiler.xls]Sheet1!$A:$A)


would be something to try. Put this formula in a cell, then check the
returned value and remove the formula.

--
Regards,
Tom Ogilvy

"peterv" wrote in
message ...

I know there is a way to find the last used row in a spreadsheet, but
I'd like to know if there is any way to determine the last row used in
a range in a spreadsheet in a closed workbook.


--
peterv
------------------------------------------------------------------------
peterv's Profile:

http://www.excelforum.com/member.php...o&userid=25572
View this thread: http://www.excelforum.com/showthread...hreadid=393787




Jean-Yves[_2_]

Finding the last row in a sheet in a closed workbook.
 
Hi Peter,

You have to open it to find out. You can do it invisibly for the user
by using application.ScreenUpdating = false before opening.

Regards
Jean-Yves

"peterv" wrote in
message ...

I know there is a way to find the last used row in a spreadsheet, but
I'd like to know if there is any way to determine the last row used in
a range in a spreadsheet in a closed workbook.


--
peterv
------------------------------------------------------------------------
peterv's Profile:

http://www.excelforum.com/member.php...o&userid=25572
View this thread: http://www.excelforum.com/showthread...hreadid=393787




peterv[_3_]

Finding the last row in a sheet in a closed workbook.
 

Tom, your suggestion works, if I'm doing it from within anothe
worksheet. What I forgot to mention (the original post was around 3am
is that I'm trying to do this in a VBA procedure. Do you, or doe
anyone know how to execute a worksheet function from within vba?
Thanks for your idea Tom.

Jean-Yves, I haven't tried your idea yet, but I'm about to

--
peter
-----------------------------------------------------------------------
peterv's Profile: http://www.excelforum.com/member.php...fo&userid=2557
View this thread: http://www.excelforum.com/showthread.php?threadid=39378


Tom Ogilvy

Finding the last row in a sheet in a closed workbook.
 
The easiest and fastest is to just do the same in a worksheet cell (just
using activecell as an example)

Activecell.Formula = "=countA(C:\myfolder\[Myfiler.xls]Sheet1!$A:$A)"
lastrow = ActiveCell.Value
ActiveCell.clearcontents

--
Regards,
Tom Ogilvy


"peterv" wrote in
message ...

Tom, your suggestion works, if I'm doing it from within another
worksheet. What I forgot to mention (the original post was around 3am)
is that I'm trying to do this in a VBA procedure. Do you, or does
anyone know how to execute a worksheet function from within vba?
Thanks for your idea Tom.

Jean-Yves, I haven't tried your idea yet, but I'm about to.


--
peterv
------------------------------------------------------------------------
peterv's Profile:

http://www.excelforum.com/member.php...o&userid=25572
View this thread: http://www.excelforum.com/showthread...hreadid=393787





All times are GMT +1. The time now is 04:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com