Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Wednesday, 3 June 2015

How to get used range in Excel ?

strFilePath = "C:\DelMelater\UserData.xlsx"
Set o1 = CreateObject("Excel.Application")
Set objworkbook = o1.Workbooks.Open(strFilePath)
Set objworksheet = objworkbook.Worksheets("Sheet1")

msgbox objworksheet.usedrange.rows.count
msgbox objworksheet.usedrange.columns.count
msgbox objworksheet.usedrange.Address

Set objworksheet = nothing
Set objworkbook = nothing
o1.Quit
Set o1 = nothing

' The First message box will give you used Rows Count
' The First message box will give you used columns Count
' The First message box will give you address of the last cell used like $F$8:$G$10

No comments:

Post a Comment

Note: only a member of this blog may post a comment.