Goal
I am trying to put data into my spreadsheet using a two dimensional array which can contain one or many products.
Take a look at my two dimensional array:
Now take a look at my wanted result:
I can't seem to correctly place the data into the Excel cells. I thought there was a 1 liner of code that could do this, but I tried a different approach and just can't seem to wrap my head around these 2d arrays... Friday can't come soon enough!
Take a look at my code:
If wSheet IsNot Nothing Then
Dim colRange() As String = {"B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U"}
For i As Integer = products.GetLowerBound(0) To products.GetUpperBound(0)
'Start at B2 ... C2 ... D2 ...
Dim r As Microsoft.Office.Interop.Excel.Range = wSheet.Range(colRange(i) & "2").Resize(products.GetLength(1))
r.Value2 = products
Next
End If
This really just doesn'T work, it will just display the (0,0), (1,0) and (2,0) values to the Excel sheet... Any suggestions?