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

Worksheet_Change(ByVal Target As Range) °ÝÃD

Worksheet_Change(ByVal Target As Range) °ÝÃD

·í¨Ï¥Î Worksheet_Change(ByVal Target As Range)
¦p¦ó³]©w Target = Range("A1:B10") ½d³ò¥H¤º ¥ô¦ó¤@­ÓÀx¦s®æ

¥t¥~·íWorksheet_Changeµ{¦¡¶i¦æ¤¤,
·|¦b¦P¤@¤u§@ªí¤¤¦³¸ê®Æ§Û¼g°Ê§@ Range("A1:B10") ½d³ò¥H¥~,
¥i§_¼È°±¤£·|¦A¤ÞµoWorksheet_Change¨Æ¥ó,
½Ð«ü±Ð

¦^´_ 1# enoch


1. "·í¨Ï¥Î Worksheet_Change(ByVal Target As Range)
¦p¦ó³]©w Target = Range("A1:B10") ½d³ò¥H¤º ¥ô¦ó¤@­ÓÀx¦s®æ"

³o¼Ë¥i¥H¬Ý¨C¤@­Ó®æ¤lªº¸ê®Æ:
for each c in target
   msgbox(c.value)  
next

³o¼Ë¥i¥H¬ÝTARGET¤¤²Ä2Äæ²Ä1¦æ®æ¤lªº¸ê®Æ
msgbox(target.cells(1,2).value)

2. "¥t¥~·íWorksheet_Changeµ{¦¡¶i¦æ¤¤,
·|¦b¦P¤@¤u§@ªí¤¤¦³¸ê®Æ§Û¼g°Ê§@ Range("A1:B10") ½d³ò¥H¥~,
¥i§_¼È°±¤£·|¦A¤ÞµoWorksheet_Change¨Æ¥ó, "

¦b§Û¼g«e«á¦h¥[¥y¥N½X

    Application.EnableEvents = False
    ....§Û¼g°Ê§@...
    Application.EnableEvents = True
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-6-11 16:14 ½s¿è

¦^´_ 1# enoch
  1. [code]Private Sub Worksheet_Change(ByVal Target As Range)
  2.     If Not Intersect(Target, Range("A1:B10")) Is Nothing Then
  3.         MsgBox Target.Address
  4.     End If
  5. End Sub
½Æ»s¥N½X
  1. Intersect ¤èªk
  2. ½Ð°Ñ¾\®M¥Î¦Ü½d¨Ò¯S©w¶Ç¦^ Range ª«¥ó¡A¦¹ª«¥ó¥Nªí¨â­Ó©Î¦h­Ó½d³ò­«Å|ªº¯x§Î½d³ò¡C
  3. expression.Intersect(Arg1, Arg2, ...)
  4. expression     ¿ï¾Ü©Êªº¹Bºâ¦¡¡C¸Ó¹Bºâ¦¡¶Ç¦^ Application ª«¥ó¡C
  5. Arg1, Arg2, ...  ¥²¿ïªºRange ª«¥óÃþ«¬¡C­«Å|ªº½d³ò¡C¥²¶·¦Ü¤Ö«ü©w¨â­Ó Rangeª«¥ó
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ·R¤£¬O­n¨D¹ï¤è¡A¦Ó¬O­n¥Ñ¦Û¨­ªº¥I¥X¡C
ªð¦^¦Cªí ¤W¤@¥DÃD