Only first row of the DataTable getting executed again and again!!

Sometimes, we all make silly mistakes and so did I !!!

One fine day, I was debugging a small script. In that script, I was importing external excel sheet into QTP’s datatable in which there were some values

I will write the sample code for that:

DataTable.Import “path for the excel sheet”  ‘Importing the external excel to DataTable

For index = 1 to 3


msgbox DataTable.Value(“companyname”,”dtGlobalSheet)


It was still msgboxing the first value in the DataTable

After much struggling, I found that it was a silly mistake that I made.

Can anyone guess, what was the mistake…..scroll down for the mistake












Couldn’t figure out………..

The mistake was:

In File > Settings > Run option, “Run on all rows” option was selected due to which after first iteration of the For loop, DataTable was getting imported again(and current row was getting reset to first) and first iteration was getting performed again and again…It sure was a Silly mistake!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s