- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¥»©«³Ì«á¥Ñ yen956 ©ó 2014-4-15 09:57 ½s¿è
¦^´_ 1# wiemanson
¤£ª¾¹D§Aªº·N«ä¬O¤£¬O³o¼Ë?
°õ¦æµ²ªG:
¬õ ºñ ÂÅ ¶À All
3 5 1 5 10
¦pªG¬O, ¸Õ¸Õ¬Ý:
Sub aa()
Dim x, sum1, sum2, sum3, sum4, sum5, sum6 As Long
x = 2
sum1 = 0
sum2 = 0
sum3 = 0
sum4 = 0
sum5 = 0
Do While Cells(x, 1) <> ""
'If .. Else ¨ã±Æ¥L, °õ¦æ¤F Cells(x, 4) = "·s", ´N¤£·|°õ¦æ¨ä¥Lªº
If Cells(x, 4) = "·s" Then
sum5 = sum5 + Cells(x, 2).Value
End If
'¦P¼Ë Cells(x, 3) = "¤j", ¤]¤£¯à¦b IF...Else ¤º
If Cells(x, 3) = "¤j" Then
sum2 = sum2 + Cells(x, 2).Value
End If
If Cells(x, 1) = "¬õ" Then
sum1 = sum1 + Cells(x, 2).Value
ElseIf Cells(x, 1) = "¬õ¬õ" Then
sum1 = sum1 + Cells(x, 2).Value
ElseIf Cells(x, 1) = "ºñ" Then
sum2 = sum2 + Cells(x, 2).Value
ElseIf Cells(x, 1) = "ÂÅ" Then
sum3 = sum3 + Cells(x, 2).Value
ElseIf Cells(x, 1) = "¶À" Then
sum4 = sum4 + Cells(x, 2).Value
Else
'¨S§@¥Î§a?
sum1 = sum1 + 0
sum2 = sum2 + 0
sum3 = sum3 + 0
sum4 = sum4 + 0
sum5 = sum5 + 0
End If
x = x + 1
Loop
Cells(3, 5) = sum1
Cells(3, 6) = sum2
Cells(3, 7) = sum3
Cells(3, 8) = sum4
Cells(3, 9) = sum5
End Sub
'¦ý¤£ª¾ "ºñ","¤j" ¦P±Æ®É, §A·Q«ç»ò³B²z?
¤S, sum1, sum2, sum3, sum4, sum5, sum6 ¤@¾ã±ÆÅܼÆ,
¥iª½±µ¥Î [E3], [F3],[G3],... ¥N´À.
¸Õ¸Õ¬Ý:- Private Sub CommandButton1_Click()
- Dim x As Integer
- x = 2
- Range("E3:I3") = 0
- Do While Cells(x, 1) <> ""
- If Cells(x, 4) = "·s" Then
- [I3] = [I3] + Cells(x, 2).Value
- End If
- If Cells(x, 3) = "¤j" Then
- [F3] = [F3] + Cells(x, 2).Value
- End If
- If Cells(x, 1) = "¬õ" Or Cells(x, 1) = "¬õ¬õ" Then
- [E3] = [E3] + Cells(x, 2).Value
- ElseIf Cells(x, 1) = "ºñ" Then
- [F3] = [F3] + Cells(x, 2).Value
- ElseIf Cells(x, 1) = "ÂÅ" Then
- [G3] = [G3] + Cells(x, 2).Value
- ElseIf Cells(x, 1) = "¶À" Then
- [H3] = [H3] + Cells(x, 2).Value
- End If
- x = x + 1
- Loop
- End Sub
½Æ»s¥N½X |
|