Hi all,
I am trying to write some visual basic to take a selection of data from a worksheet, put it into an array, and then upload it into a table on our teradata database. I've managed to do it all except for one small hitch.
One of the columns that's being pulled into the array shows a four digit location code, and then a description (all within the same cell). I want to to do the equivalent of a "=LEFT(B5,4)" type formula within the code so as to only pick up the piece I need. My current code is shown below:
The line "myArray(i, 1) = Worksheets("Order Sheet DETAIL").Cells(i, 3).Value" is the one I want to change.
Thanks in advance for any help.
Matt
I am trying to write some visual basic to take a selection of data from a worksheet, put it into an array, and then upload it into a table on our teradata database. I've managed to do it all except for one small hitch.
One of the columns that's being pulled into the array shows a four digit location code, and then a description (all within the same cell). I want to to do the equivalent of a "=LEFT(B5,4)" type formula within the code so as to only pick up the piece I need. My current code is shown below:
Code:
Sub MakeUploadRange()
Dim myArray(9 To 15008, 1 To 3)
Dim i As Integer
Dim j As Integer
For i = 9 To 15008
myArray(i, 1) = Worksheets("Order Sheet DETAIL").Cells(i, 3).Value
myArray(i, 2) = Worksheets("Order Sheet DETAIL").Cells(i, 5).Value
myArray(i, 3) = Worksheets("Order Sheet DETAIL").Cells(i, 24).Value
Next i
Call ExportOrders(myArray)
End Sub
The line "myArray(i, 1) = Worksheets("Order Sheet DETAIL").Cells(i, 3).Value" is the one I want to change.
Thanks in advance for any help.
Matt