ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Scannig number of rows (https://www.excelbanter.com/excel-programming/334259-scannig-number-rows.html)

PLPE[_16_]

Scannig number of rows
 

Hi,

At present, I have a main file which imports data from 3 seperate excel
files. Each of which contains a number of rows of data. I would call up
one of these workbooks by the following;

Workbooks(StdfFile1).Activate

Now that this workbook is open, I would like to be able to "scan" how
many rows of data this sheet contains.

By knowing the number of rows in this file, I will be able to format my
main file better, and thereby reduce it's file size.

Anybody got ideas?

Jerry


--
PLPE
------------------------------------------------------------------------
PLPE's Profile: http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=386392


Toppers

Scannig number of rows
 
Hi,

You can get the last non-blank row in Sheet1 by using the following (this
works up from last row in the sheet):

Dim lastrow as Long

With Worksheets("Sheet1")
lastrow=.Cells(rows.count,"A").end(xlup).row
End with

This assumes that column A is the "longest" so if this not the case, change
"A" to appropriate column.

HTH

"PLPE" wrote:


Hi,

At present, I have a main file which imports data from 3 seperate excel
files. Each of which contains a number of rows of data. I would call up
one of these workbooks by the following;

Workbooks(StdfFile1).Activate

Now that this workbook is open, I would like to be able to "scan" how
many rows of data this sheet contains.

By knowing the number of rows in this file, I will be able to format my
main file better, and thereby reduce it's file size.

Anybody got ideas?

Jerry


--
PLPE
------------------------------------------------------------------------
PLPE's Profile: http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=386392




All times are GMT +1. The time now is 06:38 AM.

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