0
iとj(x、y)座標をmsgboxとして印刷するにはどうすればよいですか?VBA:関数の最小値を呼び出すにはどうすればいいですか?
Sub Length_Min()
'Define variables where length and maximum lengths are integers'
Dim Length_Max As Double, Length As Double
'Comparing Variable, set maximum length to 1000m'
Length_Max = 1000
'Double for loop, within domain with increment of 0.01m.'
'Domain x[i] : 0<=x<=50 and Domain y[j]: 0<=y<=30'
For i = 0 To 50 Step 0.01
For j = 0 To 30 Step 0.01
'Subsitute x-values [i] and y- values [j] into the Total Length equation, Length.'
Length = (Sqr((5 - i)^2 + (5 - j)^2)) + (Sqr((10 - i)^2 + (20 - j)^2)) + (Sqr((30 - i)^2 + (10 - j)^2))
'If the length found from the equation Length [L(x,y)] is less than 1000, then replace Length Max with new Length found.'
'Repeat for all increments of 0.01m untill smallest L(x,y) is found.'
If Length < Length_Max Then Length_Max = Length
Next j
Next i
'Print the minimum length found and its (x,y) coordinates, point P'
MsgBox "The minimum length is : " & Length_Max & " meters" & vbNewLine & "Minimum x and y coordinates are : " & i & " , " & j
End Sub
どのように現在のメッセージボックスの出力は、あなたの条件に違うのですか? –