Protected by Copyscape
Powered By Blogger

Friday, January 17, 2020

How to count number of used rows in Excel without opening it?

The below code will demonstrate how to count number of used rows in Excel without opening it - using vbscipt in QTP.


Set objXls=CreateObject("Excel.Application")

Set objWB=objXls.WorkBooks.Open("C:\a.xls")

Set objSheet=objWB.WorkSheets(1)

MsgBox objSheet.UsedRange.Rows.Count

Set objXls=Nothing

No comments: