G
gti_jobert
Hi all,
I have the following code that loop through a sheet and fills a
Array;
Code
-------------------
i = 1
Do
ActiveSheet.Cells(i, 5).Select
If Left(ActiveCell.Value, 4) = "HDW-" Then
machine = Mid(ActiveCell.Value, 3, 1) & Right(ActiveCell.Value, 3)
j = i + 7
Do
If Len(ActiveSheet.Cells(j, 4).Value) = 9 Then
maxArray = maxArray + 1
ReDim Preserve Arry(1 To 5, 1 To maxArray)
Arry(1, maxArray) = machine
Arry(3, maxArray) = ActiveSheet.Cells(j, 4).Value 'Batch
Arry(2, maxArray) = ActiveSheet.Cells(j, 6).Value 'Part
Arry(4, maxArray) = (ActiveSheet.Cells(j, 7).Value / 1000) 'Qty
Arry(5, maxArray) = Left(ActiveSheet.Cells(j, 2).Value, 2) 'Week
EndWeek = Left(ActiveSheet.Cells(j, 2).Value, 2)
End If
j = j + 1
Loop Until ActiveSheet.Cells(j, 2).Value = ""
End If
i = i + 1
Loop Until Mid(ActiveCell.Value, 3, 1) & Right(ActiveCell.Value, 3) = "WH24"
-------------------
The problem I have is when I try to loop my values out of the array i
takes quite a long time.
How can I delete an Array value? I know I have to use Ubound o
something but I dont fully understand how it works!
Thanks for any input
I have the following code that loop through a sheet and fills a
Array;
Code
-------------------
i = 1
Do
ActiveSheet.Cells(i, 5).Select
If Left(ActiveCell.Value, 4) = "HDW-" Then
machine = Mid(ActiveCell.Value, 3, 1) & Right(ActiveCell.Value, 3)
j = i + 7
Do
If Len(ActiveSheet.Cells(j, 4).Value) = 9 Then
maxArray = maxArray + 1
ReDim Preserve Arry(1 To 5, 1 To maxArray)
Arry(1, maxArray) = machine
Arry(3, maxArray) = ActiveSheet.Cells(j, 4).Value 'Batch
Arry(2, maxArray) = ActiveSheet.Cells(j, 6).Value 'Part
Arry(4, maxArray) = (ActiveSheet.Cells(j, 7).Value / 1000) 'Qty
Arry(5, maxArray) = Left(ActiveSheet.Cells(j, 2).Value, 2) 'Week
EndWeek = Left(ActiveSheet.Cells(j, 2).Value, 2)
End If
j = j + 1
Loop Until ActiveSheet.Cells(j, 2).Value = ""
End If
i = i + 1
Loop Until Mid(ActiveCell.Value, 3, 1) & Right(ActiveCell.Value, 3) = "WH24"
-------------------
The problem I have is when I try to loop my values out of the array i
takes quite a long time.
How can I delete an Array value? I know I have to use Ubound o
something but I dont fully understand how it works!
Thanks for any input