I need to use array to store 10 elements. I am not showing them on any grid or text boxes, I need to hold the values in memory and use them when I need. Here is my code what I am doing
--Arrays2 declarations( I have same declaration for Array1)
Private Count As Integer
Private Array2 () As String
Private MaxRows As Long
Private MaxCols As Integer
Private Const item = 0
Private Const qty= 1
Private Const Number= 2
Private Const money= 3
---Check if the shipment has more than one distinct items
--if yes then load them in array
For i = 0 To (MaxRows)
If Array1(Ship, i) = oShip Then
If Array1 (item, i) <> oitem Then
Array2 (item, Count) = Array1 (item_COL, i)
Array2 (qty, Count) = Array1 (qty_COL, i)
Array2 (Number, Count) = Array1 (qty_COL, i)/ Array1 (qty_COL, i)
Array2 (money, Count) = Array1 (money_COL, i)
Count = Count + 1
oitem = Array1 (item, i)
End If
End If
Next
---check if the items are less than 10 than use Null
If Count < 10 Then
For i = Count To 10
ReDim Preserve Array2(MaxCols, Count + 1)
Array2 (item, Count) = “”
Array2 (qty, Count) = “”
Array2 (Number, Count) = “”
Array2 (money, Count) = “”
Count = Count + 1
Next
End If
--Arrays2 declarations( I have same declaration for Array1)
Private Count As Integer
Private Array2 () As String
Private MaxRows As Long
Private MaxCols As Integer
Private Const item = 0
Private Const qty= 1
Private Const Number= 2
Private Const money= 3
---Check if the shipment has more than one distinct items
--if yes then load them in array
For i = 0 To (MaxRows)
If Array1(Ship, i) = oShip Then
If Array1 (item, i) <> oitem Then
Array2 (item, Count) = Array1 (item_COL, i)
Array2 (qty, Count) = Array1 (qty_COL, i)
Array2 (Number, Count) = Array1 (qty_COL, i)/ Array1 (qty_COL, i)
Array2 (money, Count) = Array1 (money_COL, i)
Count = Count + 1
oitem = Array1 (item, i)
End If
End If
Next
---check if the items are less than 10 than use Null
If Count < 10 Then
For i = Count To 10
ReDim Preserve Array2(MaxCols, Count + 1)
Array2 (item, Count) = “”
Array2 (qty, Count) = “”
Array2 (Number, Count) = “”
Array2 (money, Count) = “”
Count = Count + 1
Next
End If