Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loop get excel value
#1
Not Solved
Hi,

I´m from Brazil and i´m beginer in QTP, i need built one script where i get a first value in the excel (A,1) and after do something. After this, i will get next value in the excel (A,2). I can´t do this. I will need a loop but i can´t.

Tks,

Jose Augusto.
Reply
#2
Not Solved
Jose -
Can be easily done. Well, I suggest, henceforth you try search this forum before you post. The reason is you dont have to wait this long to get a simple query answered.

Here is the logic,

1. Establish connection with Excel using the COM.
2. Read the Excel Workbook.
3. Read the Excel Worksheet.
4. Find out how many total rows are available.
5. Form a For loop to iterate.
6. Check for "value" in the excel cell.

See if you can get this done & Good Luck buddy.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Not Solved
Hi,

Code:
Dim xl

Set xl=createobject("excel.application")

xl.workbooks.open("Path of xls file")
xl.visible=true

RC=xl.sheets("SheetID").usedrange.rows.count

set xl_A=xl.sheets("SheetID")

for i=1 to RC

    ur_lp=xl_A.cells(i,1).value
    print ur_lp

Next

set xl=nothing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  FOR LOOP shayk1985 1 5,125 12-13-2012, 11:35 AM
Last Post: sams001
  How to exit from a for loop silpavinod 2 9,385 10-17-2012, 12:55 AM
Last Post: agarwl.anurag
  for loop sia sharma 1 3,204 09-13-2012, 11:44 AM
Last Post: ksrikanth2k9
  Help with Loop LJENNE 1 3,057 08-10-2012, 12:32 PM
Last Post: Ankesh
  How to get out of infinite FOR loop... sssidana 3 4,399 07-20-2012, 01:04 AM
Last Post: sree.85

Forum Jump:


Users browsing this thread: 1 Guest(s)