¨D±Ï: SumColor Function ¦ýn²Ö¥[«D¼ÆȪº©î¸Ñ¤èªk
- ©«¤l
- 2
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 8
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-6-18
- ³Ì«áµn¿ý
- 2024-3-1
|
¨D±Ï: SumColor Function ¦ýn²Ö¥[«D¼ÆȪº©î¸Ñ¤èªk
hi ,
¤p§Ì·Qn½Ð°Ý¤@¤U, §ÚÌ¥i¥H¥Î SumColor Function ¥h²Ö¥[¬YÓ¯S©w©³¦âªºÀx¦s®æÈ(¦p¤U½d¨Ò),
¦ý¬OY§Ú¦³Ó»Ý¨D, ¨CÓÀx¦s®æ¸Ì±ªºÈ³£¬O2Ó,¨Ò¦p "15/10" ,
§Ú·Qn¤À§O´£¥X15 or 10 ¨Ó²Îp幒¼Æ, ¸Ó«ç»ò§ï©O?
¨Ò¦p:
A1 (©³¦â:¬õ) 10/15
A2 (¥Õ) 4/3
A3 (¬õ) 5/66
A4 (ºñ) 0/30
..........................
§Ú·Qnºâ¥X¬õ©³Àx¦s®æ¸Ì, ²Öp¼ÆȬ° 10+5=15 («e) »P 15+66=81
Example======================================
Function SumColor(rColor As Range, rSumRange As Range)
Dim rCell As Range
Dim iCol As Integer
Dim vResult
Application.Volatile
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = WorksheetFunction.Sum(rCell) + vResult
End If
Next rCell
SumColor = vResult
End Function
=============================== |
|
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X
|
|
|
|
|
- ©«¤l
- 2
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 8
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-6-18
- ³Ì«áµn¿ý
- 2024-3-1
|
RE: ¨D±Ï: SumColor Function ¦ýn²Ö¥[«D¼ÆȪº©î¸Ñ¤èªk (¤w¸Ñ¨M)
¤£¦n·N«ä¥´Åͤj®a
¤w¸g§ä¨ì¤èªk¤F,
¥[ÓGetElement = Split(rCell, "/")(Num)
§â¼ÆȤè¶}´N¥i¥H¤F.ÁÂÁ |
|
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X
|
|
|
|
|