ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ELSEIF»PDO WHILE±_ª¬°j°é¨Ó§PÂ_¥[Á`

¦^´_ 1# wiemanson
  1. Option Explicit
  2. Sub Ex()
  3.     Dim x As Integer, S As Variant, AR(), AC()
  4.     With ActiveSheet
  5.         AC = Array("¬õ", "ºñ", "ÂÅ", "¶À")              'ÃC¦â°}¦C: «ü©wÃC¦â(0-3),ÃC¦â¥i¦A¼W¥[(0-?)
  6.         AR = Array("E3", "F3", "G3", "H3", "I3")  'ÃC¦â¦ì¸m°}¦C (¬õ,ºñ,ÂÅ,¶À,Á`­«¶q): Àx¦s®æªº¦ì¸m(0-4)
  7.         'Á`­«¶q¦ì¸m :UBound(AR) -> ÃC¦â¦ì¸m°}¦Cªº¯Á¤Þ­È
  8.         .Range(AR(0) & ":" & AR(UBound(AR))) = ""
  9.         x = 2
  10.         Do While .Cells(x, 1) <> ""
  11.             If .Cells(x, 4) = "·s" Then
  12.                 S = UBound(AR)                          '
  13.                 .Range(AR(S)) = .Range(AR(S)) + Cells(x, 2)
  14.             Else
  15.                 S = Mid(.Cells(x, 1), 1, 1)             '¦p¬õ¬õ®É¥iŪ¨ú"¬õ"
  16.                 If .Cells(x, 3) = "¤j" Then S = "ºñ"
  17.                 S = Application.Match(S, AC, 0)         'Match ¦p§ä¤£¨ì:¶Ç¦^¿ù»~­È
  18.                 If IsNumeric(S) Then                    'S: ¦b«ü©wÃC¦â°}¦C¤¤ªº¦ì¸m
  19.                     .Range(AR(S - 1)) = .Range(AR(S - 1)) + .Cells(x, 2)
  20.                 End If
  21.             End If
  22.             x = x + 1
  23.         Loop
  24.         S = UBound(AR)
  25.         .Range(AR(S)) = .Range(AR(S)) + Application.Sum(.Range(AR(0) & ":" & AR(S - 1)))
  26.     End With
  27. End Sub
½Æ»s¥N½X
  1. Sub aa()
  2.     Dim x As Integer, sum1 As Long, sum2 As Long, sum3 As Long, sum4 As Long, sum5 As Long, sum6 As Long
  3.     x = 2
  4.     sum1 = 0
  5.     sum2 = 0
  6.     sum3 = 0
  7.     sum4 = 0
  8.     sum5 = 0
  9.     Do While Cells(x, 1) <> ""
  10.         If Cells(x, 4) = "·s" Then
  11.             sum5 = sum5 + Cells(x, 2).Value
  12.         ElseIf Cells(x, 1) = "¬õ" Then
  13.             sum1 = sum1 + Cells(x, 2).Value
  14.         ElseIf Cells(x, 1) = "¬õ¬õ" Then
  15.             sum1 = sum1 + Cells(x, 2).Value
  16.         ElseIf Cells(x, 1) = "ºñ" Or Cells(x, 3) = "¤j" Then
  17.             sum2 = sum2 + Cells(x, 2).Value
  18.         ElseIf Cells(x, 1) = "ÂÅ" Then   'Cells(x, 3) !!!
  19.             sum3 = sum3 + Cells(x, 2).Value
  20.         ElseIf Cells(x, 1) = "¶À" Then 'Cells(x, 3) !!!
  21.             sum4 = sum4 + Cells(x, 2).Value
  22.         End If
  23.         x = x + 1
  24.     Loop
  25.     Cells(3, 5) = sum1
  26.     Cells(3, 6) = sum2
  27.     Cells(3, 7) = sum3
  28.     Cells(3, 8) = sum4
  29.     Cells(3, 9) = sum5 + sum1 + sum2 + sum3 + sum4
  30. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ­n§åµû§O¤H®É¡A¥ý·Q·Q¦Û¤v¬O§_§¹¬üµL¯Ê¡C
ªð¦^¦Cªí ¤W¤@¥DÃD