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

CountIf°ÝÃD

CountIf°ÝÃD

  1. Sub MYts()
  2. A = 1
  3. If WorksheetFunction.CountIf(Range("A1:A10,C1:D3"), A) > 0 Then
  4. MsgBox A + 1
  5. Else
  6. MsgBox A
  7. End If

  8. End Sub
½Æ»s¥N½X
½Ð°Ý¤j¤j¬°¤°»ò¤£¥i¥HRange("A1:A10,C13")?
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

¤j¤j§A¦n¡G

   ¤p§Ì¸ÕµÛ­×§ï¦p¤U§Y¥i
½Ð¸Õ¸Õ

If Application.WorksheetFunction.CountIf(Range("A1:A10", "C13"), A) > 0 Then

©Î¬O

If Application.CountIf(Range("A1:A10", "C13"), A) > 0 Then

¤]¥i¥H¡C

³o¬O¤p§Ì±`±`¬Ý¨ìª©¥D¤j¤j¨Ï¥Îªº»yªk¡C
¦Ü©ó®t²§¬°¦ó¤p§Ì¤]ÁÙ¤£¬O«Ü¤F¸Ñ¡C
ÁÙ­n½Ðª©¥D¤j¤j»¡©ú¤F¡C

TOP

¦^´_ 2# dechiuan999


    ÁÂÁ§A.
§Ú¸Õ¹L¬O¤£¦æªº.
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2010-10-21 20:12 ½s¿è

¦^´_ 3# basarasy


    §A¦b¤u§@ªí¤¤¿é¤J¤½¦¡
=COUNTIF((A1:A10,C1:D3),1)
±o¨ìªº¬O#VALUE¿ù»~­È
¦]¬°COUNTIFªºRange°Ñ¼Æ­n³sÄòÀx¦s®æ¤£¥i¥H¥Ü2­Ó½d³òªºÁp¶°
´ú¸Õ¬Ý¬ÝRang¦ì§}¦r¦ê¤£¦P±o¨ì¬Æ»ò¤£¦P±¡§Î
  1. Sub TestAddress()
  2. Set Rng = Range("A1:A10")
  3. Range(Rng.Address).Select
  4. MsgBox Rng.Address
  5. Set Rng = Range("A1:A10", "C1:D3")
  6. Range(Rng.Address).Select
  7. Range(Rng.Address).Select
  8. MsgBox Rng.Address
  9. Set Rng = Range("A1:A10,C1:D3")
  10. Range(Rng.Address).Select
  11. MsgBox Rng.Address
  12. Set Rng = Union(Range("A1:A10"), Range("C1:D3"))
  13. Range(Rng.Address).Select
  14. MsgBox Rng.Address
  15. Set Rng = Range("A1:A10 A4:A10")
  16. Range(Rng.Address).Select
  17. MsgBox Rng.Address
  18. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# Hsieh


    ©ú¤é¤F.
¨º¥u¦n¥Î
If Application.CountIf(Range("A1:A10"), A) > 0 Or Application.CountIf(Range("C13"), A) > 0 Then
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 5# basarasy
Åܳq¤@¤U
  1. Sub Ex()
  2.     Dim R, A, B
  3.     A = 1
  4.     For Each R In Range("A1:A10,C1:D3").Areas
  5.         B = B + WorksheetFunction.CountIf(R, A)
  6.     Next
  7.     If B > 0 Then MsgBox B
  8. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ basarasy ©ó 2010-10-22 00:16 ½s¿è

¦^´_ 6# GBKEE
ÁÂÁ¤j¤j.
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD