VBScript to Get Cell Value of Particular Row and Column From ExcelSheet

How to get data from a particular row and a particular column from Excel Sheet in QTP?

Check This Post For Script To Get Cell Value of Particular Row and Column From Datatable in QTP.

QTP Script to get particular cell value from ExcelSheet in the specified row.

Below script is for retrieving 2rd row,2rd column cell value from already existing excelsheet in D drive.

In excelsheet we have values as shown below

1 aa xx
2 bb yy
3 cc zz

Script to get value "bb" from ExcelSheet is

Set a=createobject("Excel.application")
Set b=a.workbooks.open("D:\es.xls")
Set c=b.worksheets("Sheet1")
msgbox d

Similarly to retrieve 3rd row,1column value(3)replace d=c.cells(2,2).value with
d=c.cells(3,1).value in the above script.

SQL Queries Collection
Movie Songs Lyrics

Other QTP Scripts
VBScript to Check Whether Particular File Exists or Not.
Check this Post for Datatable Methods.
Excel Sheet Creation and Writing Data Into It
Data Driven Using Excel Sheet
Data Driven Using Notepad


Sudhir said...

In one of aplication, I have drop down box for each Date, Month and Year to select a Travel

start date.
After selecting theses fields when we go to the next page the selected date appear as

mm/dd/yyyy format on next page as text element.
In QTP i want to verify if the date appearing on the next page is same as we select on first page.

Also if parameterize the dates of first page i want to validated the next page dates.
Can you please help me.

F n K said...

Hi Sudhir,

Hope this helps you.

first get date value into text_value variable from second page.


This is for 1st page

get selected values from dropdown box(month,date and year )


Compare both dates.If dates are same u get msg as "both dates are same".

for example:
d= a& "/" &b&"/"&c
If strcomp(d,text_value)=0 then
msgbox "both dates are same"
msgbox"dates are different"
end if

Anonymous said...

In this scenario I know which row I am using within excel. Let's say row 5.

Now in my excel there are 11 columns. Some rows have data in all columns and some do not. So for row 5 there maybe 6 columns of data.

I want to pull the data starting in Column 2 and keep getting the data until I reach a column with a blank cell. I will also need the number of columns with valid data per that row as well.

Any ideas how I can do this?

I was thinking about using a For Loop and maybe an Array.

The data I am pulling are names of Tabs on a web page. I want to pull the data and verify those tabs and names are really on the web page.

Email: slang46188 "at" aol.com

Anonymous said...


I need to check if a value in a particular cell in excel is "1" then I want QTP script to return PASS. In case value is NOT "1" then script should return FAIL.

Can someone help me in this.

Thanks a lot in advance.


Related Posts Plugin for WordPress, Blogger...