- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-7-21 05:30 ½s¿è
¦^´_ 1# sillykin
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim I As Integer
- With Sheets("¡®¡®³æ¦ì¦¨ÁZÁ`ªí¡®¡®").Range("A3")
- Do While .Offset(I) <> ""
- ¼úª÷µ{¦¡ .Offset(I), .Offset(I, 2), .Offset(I, 4)
- I = I + 1
- Loop
- End With
- End Sub
- Private Sub ¼úª÷µ{¦¡(³æ¦ì As Range, ¾ºÙ As String, ¹F¦¨ÃB As Integer)
- Dim Ar(1 To 2), M, ³d¥ôÃB As Integer, ¹F¦¨¦Ê¤À¤ñ As Single, ¼úª÷ As Integer, °ÆÁ`¼úª÷ As Integer
- ' ****(±ø¥ó¤u§@ªí¤¤) ¨S¦³ªºÂ¾ºÙ -> °ª¯Å±Mû, Åv²z¸g²z ***
- If ³æ¦ì Like "ºÞ²z*" Then
- 'ºÞ²z³æ¦ì: ¤Gµ¥Á¸²z, ¤@µ¥Á¸²z, °Æ¸g²z, ¸g²z
- '³d¥ôÃB : 600 , 700 , 800 , 900
- Ar(1) = Array("¤Gµ¥Á¸²z", "¤@µ¥Á¸²z", "°Æ¸g²z", "¸g²z") '***ºÞ²z³æ¦ì :¨S¦³ªºÂ¾ºÙ ,°ÆÁ`¸g²z
-
- Ar(2) = Array(300, 600, 700, 800, 900, 2500) '°}¦C(³d¥ôÃB) :
- Else
- 'Àç·~³æ¦ì: ¤Gµ¥Á¸²z, ¤@µ¥Á¸²z, °Æ¸g²z, ( ¨ó²z¡B¸g²z) °ÆÁ`¸g²z
- '³d¥ôÃB : 1500 , 2000, 2200, (µù1) , 2,500
- Ar(1) = Array("¤Gµ¥Á¸²z", "¤@µ¥Á¸²z", "°Æ¸g²z", "¨ó²z", "¸g²z", "°ÆÁ`¸g²z")
- Ar(2) = Array(500, 1500, 2000, 2200, "(µù1)", "(µù1)", 2500) '°}¦C(³d¥ôÃB) :
- End If
- M = Application.Match(¾ºÙ, Ar(1), 0) 'M > 0 ¬°·F³¡
- °ÆÁ`¼úª÷ = 0
- If IsError(M) Then
- '***** Match¤£¨ì¾ºÙ®É, M = ¿ù»~È -> «D·F³¡**********
- ³d¥ôÃB = Ar(2)(0) '«D·F³¡ ³d¥ôÃB: 300 ©Î 500
- If ³æ¦ì Like "ºÞ²z*" Then 'ºÞ²z³æ¦ì
- '°}¦C:ºÞ²z³æ¦ì «D·F³¡ (¼úÃg¼úª÷ ªí)
- Ar(2) = Array(0, 0, -10000, -7000, -5000, -4000, -3000, -2000, -1000, -500, 500, 55)
- ' , , <3% , <4%, <5%, <6%, <7%, <%8, <9% , <10%,>=10%,¨C1%.
- Else 'Àç·~³æ¦ì
- '°}¦C:Àç·~³æ¦ì «D·F³¡ (¼úÃg¼úª÷ ªí)
- Ar(2) = Array(0, 0, -10000, -7000, -5000, -4000, -3000, -2000, -1000, -500, 800, 75)
- '0, 0, <3% , <4%, <5%, <6%, <7%, <%8, <9% , <10%,>=10%,¨C1%.
- End If
- '***** Match¤£¨ì¾ºÙ®É, M = ¿ù»~È -> «D·F³¡ **********
- Else
- '**************·F³¡ ************************************
- If M = UBound(Ar(1)) + 1 Then °ÆÁ`¼úª÷ = 2000 '°ÆÁ`¹F¨ì¼úª÷·|¦A¦h2000¤¸
- ³d¥ôÃB = Ar(2)(M)
- If ³æ¦ì Like "ºÞ²z*" Then
- '°}¦C:ºÞ²z³æ¦ì ·F³¡ (¼úÃg¼úª÷ ªí)
- Ar(2) = Array(0, 0, -25000, -20000, -16000, -12000, -8000, -6000, -4000, -2000, 1000, 75)
- ' , , <3% , <4%, <5%, <6%, <7%, <%8, <9% , <10%,>=10%,¨C1%.
-
- Else
- '°}¦C:Àç·~³æ¦ì ·F³¡ (¼úÃg¼úª÷ ªí)
- Ar(2) = Array(0, 0, -25000, -20000, -16000, -12000, -8000, -6000, -4000, -2000, 2000, 155)
- ' , , <3% , <4%, <5%, <6%, <7%, <%8, <9% , <10%,>=10%,¨C1%.
-
- End If
- '**************·F³¡ ************************************
- End If
- ³æ¦ì.Offset(, 3) = ³d¥ôÃB
- ¹F¦¨¦Ê¤À¤ñ = Round(¹F¦¨ÃB / ³d¥ôÃB * 100, 0)
- ³æ¦ì.Offset(, 5) = ¹F¦¨¦Ê¤À¤ñ
- ¼úª÷ = 0
- If ¹F¦¨ÃB / ³d¥ôÃB * 10 < 3 Then
- M = 2
- ElseIf ¹F¦¨ÃB / ³d¥ôÃB * 10 > 10 Then
- M = 10
- ¼úª÷ = Ar(2)(UBound(Ar(2)))
- Else
- M = Int(¹F¦¨ÃB / ³d¥ôÃB * 10)
- End If
- 'Ar(2)(M) = ¼úÃgªºª÷ÃB
- ³æ¦ì.Offset(, 6) = Ar(2)(M) + ((¹F¦¨¦Ê¤À¤ñ - 100) * ¼úª÷) + °ÆÁ`¼úª÷
- '¼úª÷pºâ¤½¦¡: ¼úÃgªºª÷ÃB+ ((¹F¦¨100%¥H¤W-100)* ¼úª÷) + °ÆÁ`¼úª÷
- End Sub
½Æ»s¥N½X |
|