Hello, I am wondering if someone can help me with the following code which is not working correctly. I collect values from an external GUI and add them to an Arraylist. I am trying to add the values to excel in two columns. The results I get is that as it For loops I only get the last value. The amount values into the array will vary between amounts. I also need to add a new row into excel if the last row has a value already in it. Here is my current code:
last_Row = objSheet.Range("B" & objSheet.Rows.Count).End(xlUp).Row
For i=0 to Ubound(ArrayDoc)
If ArrayDoc(i) <> "" or ArrayRev(i) <> "" Then
myArrayList.Add ArrayDoc(i)
myArrayList.Add ArrayRev(I)
End if
next
For each a in myArraylist
objsheet.Range("B2:C" & last_Row) = a
next
Output:
last_Row = objSheet.Range("B" & objSheet.Rows.Count).End(xlUp).Row
For i=0 to Ubound(ArrayDoc)
If ArrayDoc(i) <> "" or ArrayRev(i) <> "" Then
myArrayList.Add ArrayDoc(i)
myArrayList.Add ArrayRev(I)
End if
next
For each a in myArraylist
objsheet.Range("B2:C" & last_Row) = a
next
Output:
d | d | |
d | d |