¦p¦ó ÅýFunctionªº¤Þ¼Æ,¨Ó¦Û2Ó¤£¦PSubªºÅܼÆ
- ©«¤l
- 41
- ¥DÃD
- 12
- ºëµØ
- 0
- ¿n¤À
- 71
- ÂI¦W
- 0
- §@·~¨t²Î
- Window 7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2011-8-30
- ³Ì«áµn¿ý
- 2012-8-25
|
¦p¦ó ÅýFunctionªº¤Þ¼Æ,¨Ó¦Û2Ó¤£¦PSubªºÅܼÆ
¤£¦n·N«ä¡A§Ú·Qn½Ð°Ý¦U¦ì¤j¤j
§Ú¬OVBA·s¤â¡A¹ï©ó¤Þ¼Æ¦p¦ó©I¥s¶Ç»¼¤£¬O«Ü²M·¡¡A
¦pªG§ÚnÅýFunction§@¹Bºâªº¤Þ¼Æ¬O¨Ó¦Û2Ó¤£¦Psub ¸Ó¦p¦ó°µ©O??
©ÎªÌ¥i¥Hµ¹§Ú¤@Ó¤p¨Ò¤l
ÁÂÁ¦U¦ì
Sub AA()
For Qm = 1 To 10
For Qr = 1 To 10
ThisWorkbook.Sheets("sheet2").Cells(Qm, Qr).Value = AvgManufacturerProfit(Qm, Qr)
Next
Next
End Sub
'..........................................................
Private Function AvgManufacturerProfit(ByVal Qm As Integer, ByVal Qr As Integer) As Integer
AvgManufacturerProfit = pm * Qm + w * Qr
End Function
'...................................................
Sub DDm()
b=Qr <------¦b³oÃä¦p¦óŪ¨ú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 |
|
|
|
|
|
|