ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How many rows on a Worksheet (https://www.excelbanter.com/excel-programming/295212-how-many-rows-worksheet.html)

Ed Nelson

How many rows on a Worksheet
 
I am trying to find out how many rows there on a Worksheet
using VBA code. I am doing data extraction on XLS files I
received from another company, and so I never know how
many rows there can be on a work sheet.

I have tried:
Application.SendKeys "^{END}", True
iRows = ActiveCell.Rows

But his always returns 1.

Any ideas?

Thanks!

Ed

Bob Phillips[_6_]

How many rows on a Worksheet
 
Try

iRows=cells.specialcells(xllastcell).row

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ed Nelson" wrote in message
...
I am trying to find out how many rows there on a Worksheet
using VBA code. I am doing data extraction on XLS files I
received from another company, and so I never know how
many rows there can be on a work sheet.

I have tried:
Application.SendKeys "^{END}", True
iRows = ActiveCell.Rows

But his always returns 1.

Any ideas?

Thanks!

Ed





All times are GMT +1. The time now is 11:27 AM.

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