- ©«¤l
- 559
- ¥DÃD
- 58
- ºëµØ
- 0
- ¿n¤À
- 626
- ÂI¦W
- 0
- §@·~¨t²Î
- win8
- ³nÅ骩¥»
- office2013
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- TW
- µù¥U®É¶¡
- 2010-11-22
- ³Ì«áµn¿ý
- 2024-6-14
|
¥»©«³Ì«á¥Ñ hugh0620 ©ó 2012-3-22 10:35 ½s¿è
¦^´_ 3# spermbank
³o¬O§A»Ýn¥h«ä¦Ò~ þ¤@¨Ç¬O¹Bºâ¤¤°Ê¼Æ(x)=>ì§Q1%ªº·sªÑ»ù~ ¦b½æ¥X»ùªº®ÉÔ
©Ò¥H~ ¶R»ù¬O¤@Ó¬J©wªº¨Æ¹ê±¡ªp¤U~ ¥h±Àºâ[ì§Q1%ªº·sªÑ»ù]
¦]¦¹²Ä¤GÓ°j°é~ §Ú¥Îªº¬O do loop
¥ý¨D±o°ò¥»ªº°Ñ¼ÆÈ
1. ¶R:ªÑ»ù/¤âÄò¶O
¦A¨Ì¶RªºªÑ»ù¨ÌªÑ»ùì«h¤@ÓȤ@®æÓÈ¥h±Àºâ¤p©ó©Îµ¥©ó1%Àò§QªÑ»ù
2.¥Îdo loop¥h±Àºâ½æ¥XªºªÑ»ù- Sub nn()
- '=========================='½Õ¾ãC°ÏªÑ»ù³W«h
- For Each A In Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers)
- B = Application.Lookup(A, Array(0, 11, 51, 101, 501, 1001), Array(0.01, 0.05, 0.1, 0.5, 1, 5))
- A.Offset(, 2) = Application.Ceiling(A, B)
- Next
- '=========================='Àò§Q1%ªÑ§Qpºâ¡A¤£¥]§t¤âÄò¶O¡BÃÒ¥æµ|
- Sheets("Sheet1").Select
- x = Application.WorksheetFunction.CountA(Range("A:A")) 'Äæ¦ì¦³È½d³òpºâ
- For i = 2 To x
- Cells(i, "G") = Cells(i, "C") * Cells(9, "O") + Cells(i, "C")
- Next
- '=========================='½Õ¾ãÀò§QªÑ»ù³W«h
- For Each A In Range("G:G").SpecialCells(xlCellTypeConstants, xlNumbers)
- B = Application.Lookup(A, Array(0, 11, 51, 101, 501, 1001), Array(0.01, 0.05, 0.1, 0.5, 1, 5))
- A.Offset(, 0) = Application.Ceiling(A, B)
- Next
- '=========================='pºâÀò§Q1%¦©°£¤âÄò¶O»PÃÒ¥æµ|ª÷ÃB
- Sheets("Sheet1").Select
- x = Application.WorksheetFunction.CountA(Range("A:A")) 'Äæ¦ì¦³È½d³òpºâ
- For i = 2 To x
- K = Cells(i, "C") '¶R¶iªÑ»ù¡A¬O¤@Ó©T©wȪº±ø¥ó¤U¡A±Àºâì§Q±µ±µªñ1%®ÉªºªÑ»ù¤ÎÀò§Q
- If K * 1000 * 0.001425 * 0.28 <= 20 Then '¶R¶i¤âÄò¶O¬O¤@Ó¤wµo¥Íªº±ø¥ó¡AY§C©ó20¶ê¡A«h¬°20¶ê¡A
- ABuyP = 20
- Else
- ABuyP = B * 1000 * 0.001425 * 0.28
- End If
- ABuy = K * 1000 + ABuyP
- B1 = Application.Lookup(K, Array(0, 11, 51, 101, 501, 1001), Array(0.01, 0.05, 0.1, 0.5, 1, 5)) 'ªÑ»ù¼W¥[¤ñ²v
- J = 0
- Do
- B2 = B1 * J
- If (K + B2) * 1000 * 0.001425 * 0.28 <= 20 Then '½æ¥X¤âÄò¶OY§C©ó20¶ê¡A«h¬°20¶ê
- ABuyP1 = 20
- Else
- ABuyP1 = (K + B2) * 1000 * 0.001425 * 0.28
- End If
- ASell = (K + B2) * 1000 - (K + B2) * 1000 * 0.003 - ABuyP1
- A = (ASell - ABuy) / ABuy
- J = J + 1
- Loop While A <= 0.01 '³f§Q¦b>=0.01®É¡A°±¤î¹Bºâ
- Cells(i, "K") = K + B2 - B1 'pºâÀò§Q¦©°£¤âÄò¶O»PÃÒ¥æµ|ªºÀò§Q%¼Æ
- Cells(i, "L") = (((K + B2 - B1) * 1000 - (K + B2 - B1) * 1000 * 0.003 - ABuyP1) - ABuy) / ABuy
- Cells(i, "M") = (((K + B2 - B1) * 1000 - (K + B2 - B1) * 1000 * 0.003 - ABuyP1) - ABuy) 'pºâÀò§Q¦©°£¤âÄò¶O»PÃÒ¥æµ|ªºÀò§Qª÷ÃB
- Next
- End Sub
½Æ»s¥N½X |
|