If anyone could help me I would appreciate it. I need to sort an the array below first by priming and painting times together. Meaning there will be an 8 dimesional array.
I have the following data in Excel:
Type of Vehicle Priming Time Painting Time
a 1.25 1.75
b 0.60 0.70
c 1.10 1.45
d 1.00 0.70
0.60 first and 1.75 last keeping track of whether the times were taken from painting or priming. I need to do this to put the vehicles in a special order using the following algorithm:
IF the smallest time (0.60 for example) in priming then it is the first vehicle.
If the smallest time is in painting it goes last.
IF the next smallest time is in priming it is the next vehicle. If the next smallest time is in painting move to Last-1. And so on until you run out of vehicles.
Output should be the name of the vehicle in an array where i= 1 to 4. 1=first and 2=last
I loaded the data using the following code:
For i = 1 To 4
'Load Priming_Painting information
NPriming(i) = ActiveSheet.Cells(i + 4, 2).Value
PrimingTime(i) = ActiveSheet.Cells(i + 4, 3).Value
PaintingTime(i) = ActiveSheet.Cells(i + 4, 4).Value
Next i
I then inputted into a 8 dimesional array.
Dim First As Integer, Last As Integer
First = LBound(PrimingTime)
Last = UBound(PrimingTime)
Dim Timelist(8, 8) As Double
Dim Namelist(8, 8) As String
i = 0
For i = 1 To Last
Timelist(i, 1) = PrimingTime(i)
Timelist(i + 4, 2) = PaintingTime(i)
Namelist(i, 1) = NPriming(i)
Namelist(i + 4, 2) = NPriming(i)
Next i
But now having problems sorting and eventually condensing to a array of 4 elements in that sort order.
Can anyone help?
Thank you in advance
Greg
I have the following data in Excel:
Type of Vehicle Priming Time Painting Time
a 1.25 1.75
b 0.60 0.70
c 1.10 1.45
d 1.00 0.70
0.60 first and 1.75 last keeping track of whether the times were taken from painting or priming. I need to do this to put the vehicles in a special order using the following algorithm:
IF the smallest time (0.60 for example) in priming then it is the first vehicle.
If the smallest time is in painting it goes last.
IF the next smallest time is in priming it is the next vehicle. If the next smallest time is in painting move to Last-1. And so on until you run out of vehicles.
Output should be the name of the vehicle in an array where i= 1 to 4. 1=first and 2=last
I loaded the data using the following code:
For i = 1 To 4
'Load Priming_Painting information
NPriming(i) = ActiveSheet.Cells(i + 4, 2).Value
PrimingTime(i) = ActiveSheet.Cells(i + 4, 3).Value
PaintingTime(i) = ActiveSheet.Cells(i + 4, 4).Value
Next i
I then inputted into a 8 dimesional array.
Dim First As Integer, Last As Integer
First = LBound(PrimingTime)
Last = UBound(PrimingTime)
Dim Timelist(8, 8) As Double
Dim Namelist(8, 8) As String
i = 0
For i = 1 To Last
Timelist(i, 1) = PrimingTime(i)
Timelist(i + 4, 2) = PaintingTime(i)
Namelist(i, 1) = NPriming(i)
Namelist(i + 4, 2) = NPriming(i)
Next i
But now having problems sorting and eventually condensing to a array of 4 elements in that sort order.
Can anyone help?
Thank you in advance
Greg