ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to determine a range size (https://www.excelbanter.com/excel-programming/291098-how-determine-range-size.html)

cici

How to determine a range size
 
I want to know the number of data lines in an imported
file (text file), so I can define an exact range using VBA
after it's imported. Is there a function I can use?

Peter Atherton[_30_]

How to determine a range size
 

-----Original Message-----
I want to know the number of data lines in an imported
file (text file), so I can define an exact range using

VBA
after it's imported. Is there a function I can use?
.

After the file is Imported

'get in the range
Range("A2").select
nr = activecell.currentregion.rows.count

or

nr = application.worksheetfunction.counta(Range("A:A"))

Regards
Peter


All times are GMT +1. The time now is 01:07 PM.

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