To write test Results into a column in excel
Hi,
I am getting test data from an excel file and wish to write the result for a particular test into a specific column called "CardNumber" on the same row (in the same excel file) . I'm using DDT.ExcelDriver to loop through the data rows.
The value of the CardNumber is extracted from:
var CardNum = tabControl.m_tpgCards.RegisteredCardsForm.m_Cards.wSelectedItems;
Any suggestion on how to code this using JavaScript have given the value of CardNum (above) for each row?.
Thanks in advanced...
Azeddin.
Azeddin_Margani wrote:
inputRow = excelMainSheet.UsedRange.Rows.Count;
excelMainSheet.Range("K" + inputRow).Value =CardNum;
OK. You're not mixing COM and DDT. That's good. :)
As previously explained, the above code is your problem. UsedRange gets the last row. So you are always writing to the last row.
If this is looping through 100 rows of data, I assume you must have it in some sort of loop?
In which case (pseudocode) you want something like:
Loop Start Do your test and extract the value Excel.Cells(Loop, Column) = Your_Value End Loop
Or something like that.
Basically, as shankar_r says, you need to track the row you are on. Which I presume you are (or will be) doing if you're using the same sheet for you input data?
(Incidentally, I've used the "Cells" method in Excel. Which uses a numeric for both Row and Column. You can use Range, but it's really designed for updating multiple cells in one go. But it will work with a single cell value.)