View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Michael[_27_] Michael[_27_] is offline
external usenet poster
 
Posts: 41
Default Walk me through this VBA piece please

Hi everyone,

I have this piece of VBA code:

For JobNr = 1 To 25
result = vehicleModel.ReadModel("MCS2vehicle.mpl")

If result 0 Then
MsgBox vehicleModel.ErrorMessage
Else
vehicleModel.Solve
If JobNr < 1 Then
myVal = Range("M10").Value
With Workbooks(filename).Worksheets("ParetoFrontier")
Set myObjRng = .Range("M10", .Cells(.Rows.Count, "M").End(xlUp))
If Application.CountIf(myObjRng, myVal) 0 Then
GoTo NextJobNr
End If
End With
End If
Write solution
Next

It supposed to allow only NEW (same one to be excluded) solutions to
be written down. The 1st solution is in "M10"

So everytime a solution is found, it has to compare it with previous
ones in colmun M, if new it will write it down otherwise JobNr will
turn to next.

What is wrong in it please?

Thanks alot,
Mike