'..........................................................
Private Function AvgManufacturerProfit(ByVal Qm As Integer, ByVal Qr As Integer) As Integer
AvgManufacturerProfit = pm * Qm + w * Qr
End Function
'...................................................
Sub DDm()
b=Qr <------在這邊如何讀取AA()裡面的Qr
DDm = ActualDemand_Dm(a, b)
End Sub
Private Function ActualDemand_Dm(ByVal Dm As Long, ByVal Qr As Integer) As Long
r = 0.5
For i = 1 To 10
a = Cells(i, 2) - Qr
If a > 0 Then
Cells(i, 3) = Cells(i, 1) + r * a
ElseIf a <= 0 Then
Cells(i, 3) = Cells(i, 1)
End If
Next
End Function作者: GBKEE 時間: 2011-9-2 12:51
回復 1#Helain
看不懂你的用意為何
Sub DDm() <-應修正為Function DDm()
' b=Qr <------在這邊如何讀取AA()裡面的Qr
可以在模組頂端 DIM 或 PUBLIC 宣告變數 Qr
DDm = ActualDemand_Dm(a, b) '<-語法錯誤
'DDm為程序名稱 必須是函數或變數才可以加上 =
End Sub