EML
03-17-2012, 09:29 AM
Hey guys, I'm new here.
I got a big school project in Excel ahead of me, so I'll be here quite often :whistle:
I'm planning to contribute, but first .. I need a help :help
I'm trying to convert this code written in java to VBA:
package jobshop;
import java.util.ArrayList;
import java.util.List;
public class JobShop {
final int N=3, M=3;
final int MAXINT=100000;
int[ ][ ] ProcessingTimes;
int[ ][ ] Order;
int[ ][ ] Solution;
int[] MachineReady = new int[M];
int[] JobReady = new int[N];
private class Phase {
int job;
int machine;
int order;
public Phase(int job, int machine, int order){
this.job = job; this.machine = machine; this.order= order;
}
}
private int readNfromExcel(){
return N;
}
private int readMfromExcel(){
return M;
}
private int[][] loadPhaseOrderFromExcel(){
int [][] A= new int[N][M]; //Job - Machine
A[0][0]=0; A[0][1]=1; A[0][2]=2;
A[1][0]=2; A[1][1]=0; A[1][2]=1;
A[2][0]=0; A[2][1]=1; A[2][2]=2;
return A;
}
It's just small part of the code, I think I can do the rest If you can help me with the start.
My main problem is that I don't know how to represent few things in VBA and what are their substitutions. Is everything supposed to be in one single module?
Last part should not be inputed manually in code, but from excel worksheets. But I'm gonna deal with it later after verification that it works properly. Also those arrays will be much bigger.
Here's what I got so far.
Dim N As Integer: N = 3
Dim M As Integer: M = 3
Dim MAXINT As Integer: MAXINT = 100000
Dim ProcessingTimes()
Dim order()
Dim Solution()
Dim MachineReady(M) As Integer
Dim JobReady(N) As Integer
Private Sub Phase()
Dim job As Integer
Dim machine As Integer
Dim order As Integer
Public Sub Phase(job, machine, order)
Me.job = job
Me.machine = machine
Me.order = order
End Sub
Private Function readNfromExcel() As Integer
Return N
End Function
I'm getting compile error in that "return N" line. I don't know if the rest is ok.
So .. can anybody help me, please? : pray2:
I got a big school project in Excel ahead of me, so I'll be here quite often :whistle:
I'm planning to contribute, but first .. I need a help :help
I'm trying to convert this code written in java to VBA:
package jobshop;
import java.util.ArrayList;
import java.util.List;
public class JobShop {
final int N=3, M=3;
final int MAXINT=100000;
int[ ][ ] ProcessingTimes;
int[ ][ ] Order;
int[ ][ ] Solution;
int[] MachineReady = new int[M];
int[] JobReady = new int[N];
private class Phase {
int job;
int machine;
int order;
public Phase(int job, int machine, int order){
this.job = job; this.machine = machine; this.order= order;
}
}
private int readNfromExcel(){
return N;
}
private int readMfromExcel(){
return M;
}
private int[][] loadPhaseOrderFromExcel(){
int [][] A= new int[N][M]; //Job - Machine
A[0][0]=0; A[0][1]=1; A[0][2]=2;
A[1][0]=2; A[1][1]=0; A[1][2]=1;
A[2][0]=0; A[2][1]=1; A[2][2]=2;
return A;
}
It's just small part of the code, I think I can do the rest If you can help me with the start.
My main problem is that I don't know how to represent few things in VBA and what are their substitutions. Is everything supposed to be in one single module?
Last part should not be inputed manually in code, but from excel worksheets. But I'm gonna deal with it later after verification that it works properly. Also those arrays will be much bigger.
Here's what I got so far.
Dim N As Integer: N = 3
Dim M As Integer: M = 3
Dim MAXINT As Integer: MAXINT = 100000
Dim ProcessingTimes()
Dim order()
Dim Solution()
Dim MachineReady(M) As Integer
Dim JobReady(N) As Integer
Private Sub Phase()
Dim job As Integer
Dim machine As Integer
Dim order As Integer
Public Sub Phase(job, machine, order)
Me.job = job
Me.machine = machine
Me.order = order
End Sub
Private Function readNfromExcel() As Integer
Return N
End Function
I'm getting compile error in that "return N" line. I don't know if the rest is ok.
So .. can anybody help me, please? : pray2: