ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   count of rows (https://www.excelbanter.com/excel-programming/370822-count-rows.html)

kpriyac[_4_]

count of rows
 

I am creating an excel file programatically. Assume I added 10 rows.
I need to write VBA code to see the count of rows in the excel file.
How do I get this. There is a hidden list in the excel file with 500
rows or so. I do not want the count to reflect these rows. I only want
the count for the 10 rows that I added. how is it done? Would having
hidden rows for validation make a difference to the count of rows?


--
kpriyac
------------------------------------------------------------------------
kpriyac's Profile: http://www.excelforum.com/member.php...o&userid=37535
View this thread: http://www.excelforum.com/showthread...hreadid=573206


Bob Phillips

count of rows
 
Set rng = Intersect(Rows.SpecialCells(xlCellTypeVisible), _
Rows("1:" & Rows.SpecialCells(xlCellTypeLastCell).Row))
MsgBox rng.rows.count

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kpriyac" wrote in
message ...

I am creating an excel file programatically. Assume I added 10 rows.
I need to write VBA code to see the count of rows in the excel file.
How do I get this. There is a hidden list in the excel file with 500
rows or so. I do not want the count to reflect these rows. I only want
the count for the 10 rows that I added. how is it done? Would having
hidden rows for validation make a difference to the count of rows?


--
kpriyac
------------------------------------------------------------------------
kpriyac's Profile:

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





All times are GMT +1. The time now is 11:19 PM.

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