- ©«¤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
|
¦^´_ 23# 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, ³d¥ôÃB As Integer, ¹F¦¨¦Ê¤À¤ñ As Single, ¼úª÷ As Integer, °ÆÁ`¼úª÷ As Integer
- ' ****(±ø¥ó¤u§@ªí¤¤) ¨S¦³ªºÂ¾ºÙ -> °ª¯Å±Mû, Åv²z¸g²z ***
- Dim ³¡ªù As String, ºÙ©I As String, M As Integer, A As Integer
- ' *******LTrim¡BRTrim »P Trim ¨ç¼Æ ¶Ç¦^¤@Ó¨S¦³«eÀYªÅ¥Õ (LTrim)¡B«á±ªÅ¥Õ (RTrim)***************************
- '©Î«e«á§¡µLªÅ¥ÕªºVariant (String)¡A¨ä¤¤©Ò§t¬°µ¹©wªº¦r¦ê¡C*
- ºÙ©I = Trim(³æ¦ì.Offset(, 2)) '¶Ç¦^¾ºÙ«e«á§¡µLªÅ¥ÕªºVariant (String) *
- '************************************************************************************************************
- ³æ¦ì.Offset(, 7) = Application.Match(ºÙ©I, Array(0, "°ÆÁ`¸g²z", "¨ó²z", "°ª¯Å±Mû", "¸g²z", _
- "Åv²z¸g²z", "°Æ¸g²z", "°Æ²z", "¤@µ¥Á¸²z", "¤Gµ¥Á¸²z", "·~°È±Mû", "¿ì¨Æû", "§U²zû", "¶±û", "ªA°È¥Í"), 0)
- '************************************************************************************************************
- '************************************************************************************************************
- ³¡ªù = Replace(³æ¦ì, "³æ¦ì", "") '¥h±¼ "³æ¦ì" ¶Ç¦^ ¼Æ¦r©Î¤å¦r *
- If Mid(³¡ªù, 1, 1) Like "[0-9]" Then ³¡ªù = "Àç·~³¡ªù" '¬°¼Æ¦r->Àç·~³¡ªù *
- ³d¥ôÃB = IIf(³¡ªù = "Àç·~³¡ªù", 500, 300) '¹w³]¬°«D·F³¡ªº³d¥ôÃB *
- °ÆÁ`¼úª÷ = 0 '¹w³]¬°°ÆÁ`¼úª÷¬° 0 *
- '************************************************************************************************************
- If ³¡ªù = "Àç·~³¡ªù" Then
- Ar = Array(0, 0, -10000, -7000, -5000, -4000, -3000, -2000, -1000, -500, 800, 75) '«D·F³¡(¼úÃg¼úª÷)
- If ³æ¦ì.Offset(, 7) <= 10 Then
- Ar = Array(0, 0, -25000, -20000, -16000, -12000, -8000, -6000, -4000, -2000, 2000, 155) '·F³¡ (¼úÃg¼úª÷)
- M = Application.Match(ºÙ©I, Array("°ª¯Å±Mû", "¤Gµ¥Á¸²z", "¤@µ¥Á¸²z", "°Æ¸g²z", "¨ó²z", "¸g²z", "°ÆÁ`¸g²z"), 0)
- 'M = > Match ªº¼Æ¦r
- ³d¥ôÃB = Application.Index(Array(100, 1500, 2000, 2200, "(µù1)", "(µù1)", 2500), M) '³d¥ôÃB °}¦C(°ª¯Å±Mû->100)
- 'Index ¶Ç¦^¤@Óªí®æ©Î½d³ò¤ºªº¬YÓȩΰѷӦì§}¡C
- °ÆÁ`¼úª÷ = IIf(ºÙ©I = "°ÆÁ`¸g²z", 2000, 0)
- End If
- Else
- ³¡ªù = "ºÞ²z³¡ªù"
- Ar = Array(0, 0, -10000, -7000, -5000, -4000, -3000, -2000, -1000, -500, 500, 55) '«D·F³¡(¼úÃg¼úª÷)
- If ³æ¦ì.Offset(, 7) <= 10 Then
- Ar = Array(0, 0, -25000, -20000, -16000, -12000, -8000, -6000, -4000, -2000, 1000, 75) '·F³¡ (¼úÃg¼úª÷)
- M = Application.Match(ºÙ©I, Array("°ª¯Å±Mû", "¤Gµ¥Á¸²z", "¤@µ¥Á¸²z", "°Æ¸g²z", "¸g²z"), 0) '***ºÞ²z³æ¦ì :¨S¦³ªºÂ¾ºÙ ,°ÆÁ`¸g²z
- ³d¥ôÃB = Application.Index(Array(100, 600, 700, 800, 900, 2500), M) '³d¥ôÃB °}¦C(°ª¯Å±Mû->100)
- 'ºÞ²z³¡ªù¨S¦³°ÆÁ`¸g²z -> ' °ÆÁ`¼úª÷ = IIf(ºÙ©I = "°ÆÁ`¸g²z", 2000, 0)
- End If
- End If
- ³æ¦ì.Offset(, 3) = ³d¥ôÃB
- '*************************************** FÄæ (¹F¦¨¤ñ²v¢H)¥Î¤½¦¡¦³¨â¦¡¥i¥Î*******************************
- ³æ¦ì.Offset(, 5) = "=Round(RC[-1] / RC[-2] * 100, 0)" 'R1C1ªí¥Üªk
- '³æ¦ì.Offset(, 5) = "=Round(" & ³æ¦ì.Offset(, 4).Address & " / " & ³æ¦ì.Offset(, 3).Address & "* 100, 0)"
- '*******************************************************************************************************
- ¹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(UBound(Ar))
- Else
- M = Int(¹F¦¨ÃB / ³d¥ôÃB * 10)
- End If
- ³æ¦ì.Offset(, 6) = Ar(M) + ((¹F¦¨¦Ê¤À¤ñ - 100) * ¼úª÷) + °ÆÁ`¼úª÷ 'Ar(M) = ¼úÃgªºª÷ÃB
- '¼úª÷pºâ¤½¦¡: = ¼úÃgªºª÷ÃB+ ((¹F¦¨100%¥H¤W-100)* ¼úª÷) + °ÆÁ`¼úª÷
- End Sub
½Æ»s¥N½X |
|