Help On Array Loop
I'm trying to read from one excel sheet and write the same data to another excel sheet, below is the code what I wrote, but I'm unable to write all the data to the target sheet... only last value is written to excel sheet... how to get the values into the array and how to put each value to target excel sheet? Please suggest
Sub anotherexcelvalues
anotherexcelvalues
'open other excel file
Set Excel1 = Sys.OleObject("Excel.Application")
Set ExlFile = Excel1.Workbooks.Open("E:\Exported Reports\MyResults.xlsx")
Set Shtname = Excel1.Sheets("Sheet1")
Delay 500
'call other excel data
i = 1
If NOT checkexcelcells = "" Then
Shtname.Cells(i,1).Value = checkexcelcells()
i = i + 1
End If
End Sub
========================================
Function checkexcelcells()
checkexcelcells()
'Open Excel Connection
Set Excel = Sys.OleObject("Excel.Application")
Call Excel.Workbooks.Open("E:\Exported Reports\PaymentSchedule_04-04-2012_11-52.xls")
Delay 500
'Check number of rows created in the excel sheet
i = Excel.ActiveSheet.UsedRange.Rows.Count
If i > 1 Then
For j = 2 to i
For k = 5 to 5
Cellvalue = VarToString(Excel.Cells(j,k).Value)
Log.Message Cellvalue
Next
Next
checkexcelcells = Cellvalue
End If
End Function
