Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Writing Unique Solutions; what could be wrong here?

Hi Everyne,

Below is the code piece I am using although it is not working yet! Allow
me please to state the followings:

1)A solution has 8 components (from 0 to 7),
2)1st solution starts at C10 (i.e. cells(10,3)), and end
at J10,
3)The model is assumed to run 50 times


Dim rng As Range
Dim cella As Range
Dim cell1 As Range
Dim i As Long
Dim solutionArray(0 To 7) As Variant
Dim cnt As Long
Dim bDup As Boolean

Cline = 1
For JobNr = 1 To 50 'run the model 50 times
vehicleModel.Solve
i = 0
For Each mac In vehicleModel.Macros
solutionArray(i) = mac.Value 'For each run, write its solution into an array
i = i + 1
Next

If Not IsEmpty(Cells(10, 3)) Then
Set rng = Range(Cells(10, 3), Cells(60, 3).End(xlUp))
' Cells (10,3) is where 1st component
' of 1st solution is written

For Each cella In rng
i = 0
cnt = 0
bDup = False

For Each cell1 In cella.Resize(1, 8)
If cell1.Value = solutionArray(i) Then

cnt = cnt + 1

End If

i = i + 1
Next
If cnt = 8 Then
bDup = True
Exit For
End If
Next
End If
If Not bDup Then

' write solution array
NEXT

What is missing here to make this code piece work?

Thanks,
Mike
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing a macro that updates solver solutions? tdogg241 Excel Worksheet Functions 2 May 31st 06 03:41 PM
Ensure unique solutions to random formula Clayman Excel Worksheet Functions 5 February 24th 06 07:45 PM
Using VBA: Avoiding Writing Down Duplicate Solutions Michael[_27_] Excel Programming 1 May 25th 04 02:30 AM
VBA to write Unique Solutions ONLY? Michael[_27_] Excel Programming 3 May 22nd 04 05:41 PM
Using VBA, how to write unique solutions only? Michael[_27_] Excel Programming 0 May 6th 04 04:27 PM


All times are GMT +1. The time now is 01:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"