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

[µo°Ý] ½Ð°Ý¸Ó¦p¦ó¦Û°Ê°O¿ý¥[Á`

¥»©«³Ì«á¥Ñ kobo ©ó 2012-2-13 21:28 ½s¿è

¦]Åv­­µLªk¤U¸üÀÉ®×,¬G¶È´£¨Ñ­Ó¤H¨Ï¥Îddeªº¸gÅç¤À¨É

Worksheet_Calculate¨Æ¥ó:¦¹¨Æ¥ó·|¦b­«·s­pºâ¤u§@ªí«áµo¥Í¡C
­º¥ý¥²¶·²M·¡¤F¸Ñ¨Æ¥óIJµoªº¹Lµ{(¦h´ú¸Õ¦³§U©ó§Aªº¤u§@),
·í¶}±ÒÀÉ®×®É,excelªº¤u§@ªí¤¤¦p¦³dde³sµ²,­pºâ¤½¦¡,©Î®É¶¡¨ç¼Æµ¥(­«·s­pºâ¤u§@ªí)§¡·|IJµo¦¹¤@¨Æ¥ó,
©Ò¥H±z¤@¶}±ÒÀÉ®×¥B§ó·sdde®É,Àx¦s®æªºdde¸ê®Æ©|¥¼§ó·s§¹¥þ¦ÓCalculate¨Æ¥ó¤vIJµo,¬Gµo¥Í¿ù»~,
¸Ñ¨M¤èªk¦p¦P Hsieh ©Ò­z,
­Ó¤H©Ò¨Ï¥Îªº¤èªk¬°«Ø¥ß¤@­Ó¶}Ãö(¦p¦ó«Ø¥ß¨£¤¯¨£´¼)
¨Ò¦p:
Private Sub Worksheet_Calculate()

        if [A1]=1 then Call Catch_DDE

End Sub
¤W­z[A1]¬°¶}Ãö,¥u¦³¦b[A1]=1®É,¤è°õ¦æCatch_DDE
¥tÁקKCalculateIJµo«á,©Ò°õ¦æªºµ{§Ç©|¥¼°õ¦æ§¹²¦¤S¦AIJµo¦Ó²£¥Í¿ù»~,
«ØijIJµo«á±N Application.EnableEvents = False
    µ²§ô«á¦A±N  Application.EnableEvents = True
¦p¤W¨Ò§ï¬°
Private Sub Worksheet_Calculate()
        Application.EnableEvents = False
        if [A1]=1 then Call Catch_DDE
        Application.EnableEvents = True
End Sub

If IsError(.[J12]) Then Exit Sub ³o¤@¦æ «ç»ò¥[¤£¤W¥h¡A¥X²{½sĶ¿ù»~
¬ã§P±z¬O¦b½L¤¤­×§ïµ{¦¡,dde¤@ª½§ó·s,¤£Â_IJµoCalculate,µ{¦¡½X¼g¤£§¹´NIJµo¨Æ¥ó,·íµM²£¥Í¿ù»~,
¦p¥H«á»Ý½L¤¤­×§ï,«Øij¥i¥Î½Æ»sµ{¦¡½X¦A¶K¤W©Î¦b­×§ïªº¦æ¤W¥ý¥[ ' ,Åܦ¨µù¸Ñ«á¦A½s¼g,§¹¦¨«á¦A§R°£ '


SetLinkOnData ¤èªk:³]©w¨C·í§ó·s DDE ³s½u®É°õ¦æªºµ{§Ç¦WºÙ¡C
¥Ñ¦r¸q¤W»¡¦¹ªk¥u¦³¦b DDE ³s½u¸ê®Æ§ó·s®É¤è°õ¦æ ±z­n³]©wªºµ{§Ç
¬G¦¹ªk»PWorksheet_Calculate¨Æ¥ó¦³¨Ç¤£¦P,¬O¥i¥H¤À¶}¨Ï¥Îªº
³o«üªºDDE¬O«ü¦³¤Þ¤J¦b¤u§@ªíªºDDE ¥N½X,
¶}½L»ù¡B³Ì°ª»ù¡B³Ì§C»ù¡B¦¨¥æ»ù¡B¦¨¥æ¶qµ¥¦U¦³¦UªºDDE¥N½X
¨Ò:
Sub ³]©w¦¨¥æ¶qDDE()'¥u¦³¦b¦¨¥æ¶q¸ê®Æ§ó·s®É¤~·|°õ¦æCatch_DDE,¨ä¥LDDE¥N½X§ó·s¤£·|°õ¦æ

    ThisWorkbook.SetLinkOnData "YES|DQ!EXFB2.Volume", "Catch_DDE"

End Sub

Sub ¸Ñ°£¦¨¥æ¶qDDE()'¦¨¥æ¶q¸ê®Æ§ó·s®É ¤]¤£·|°õ¦æ¥ý«e©Ò³]©wªºµ{§Ç

    ThisWorkbook.SetLinkOnData "YES|DQ!EXFB2.Volume", ""

End Sub

Worksheet_Calculate¨Æ¥ó »P SetLinkOnData ¤èªk ¦U¦³¦Uªº¯SÂI,ÁÙ±æ¨Ï¥ÎªÌ¦Û¦æ´ú¸Õ,
§ä¥X²Å¦X¦Û¤vªº»Ý¨D.

¯¬±z¾Ç²ß´r§Ö

TOP

¦^´_ 20# leefing

¥»¤H¨ÃµLDDE¹ê»Ú¸gÅç¡A¨Ì¾Úkoboªº¸gÅç
ª½±µ©ó¶}ÀÉ»PÃöÀɨϥÎSetLinkOnData¤èªk´N¥i¹F¨ì¦Û°Ê¤Æ¤F
  1. Sub Catch_DDE()
  2. '³æ¶q10¡AµM«á¦¨¥æ=¶R¶i¡A©Ò¥H"ªÅ"¤U­±¨º¤@®æ¥X²{10
  3. If IsError([J12]) Then Exit Sub  '³æ¶q³sµ²¿ù»~´N°±¤î­pºâ
  4. If [J12] >= 10 Then  '³æ¶q10¥H¤W°õ¦æ
  5.    If [D12] = [F12] Then [U12] = [U12] + [J12]
  6.    If [E12] = [F12] Then [T12] = [T12] + [J12]
  7. End If
  8. End Sub

  9. Sub auto_open()
  10. ThisWorkbook.SetLinkOnData "YES|DQ!EXFB2.Volume", "Catch_DDE"  '±Ò°ÊSetLinkOnData¤èªk
  11. End Sub

  12. Sub auto_close()
  13. ThisWorkbook.SetLinkOnData "YES|DQ!EXFB2.Volume", ""   'Ãö³¬SetLinkOnData¤èªk
  14. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ appr ©ó 2012-2-19 22:43 ½s¿è

¤£¦n·N«ä!!!·Q½Ð±Ð¦U¦ì¤@¤U¡A§Ú¦Û¤v¦³¦b¥t¥~µoªí¤@½g¥DÃD!!¤£¹L§Ú¦b³oÃ䦳¬Ý¨ì¦n¹³¸ò§ÚÃþ¦üªº

©Ò¥H·Q½Ð±Ð¤@¤U!!§Úªº³o­Ó°ÝÃDªº°µªk¤]¬O­n¥ÎSetLinkOnData¶Ü?

§Úªº°ÝÃD¬O
             A1         A2        A3
¬[ºc¡G ¶i³f     °h³f     ®w¦s
                                       10

§Ú¦b¶i³fªº®É­Ô¬O±qA1©³¤U¿é¤J

¦Ó¤½¦¡´N¬O=SUM(A3-A1) ¨º´N·|¥X²{¥Ø«eªº®w¦s¶q

¦ý¦pªG§Ú¤£¤p¤ß§â¶i³fªº¼Æ­ÈDelete ¨º ®w¦sªº­È´N·|®ø¥¢!!! ¦ý§Ú¤£ª¾¹D»¡ ¡A ¦³­þ­Ó¤½¦¡¥i¥H¦Û°Ê¬ö¿ýA3®w¦sªº¼Æ­È¶Ü???

ÁÙ¬O»¡¥i¥H§âµ{¦¡Ãö±¼ªº®É­Ô¦Û°Ê§ó·s®w¦s¶q ¥H¤Î §â A1ªº ¼Æ­Èµ¹²M°£

TOP

¦^´_ 23# appr

1.gif

¤u§@ªí¼Ò²Õ
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. If Target.Address = "$A$2" And [A2] <> "" Then
  3.    [C2] = [C2] + [A2]
  4.    [A2] = ""
  5. End If
  6. If Target.Address = "$B$2" And [B2] <> "" Then
  7.    [C2] = [C2] - [B2]
  8.    [B2] = ""
  9. End If
  10. End Sub
½Æ»s¥N½X

TOP

¬Oªº!!³o´N¬O§Ú·Q­n°µªº³¡¤À!!!¯uªº«Ü·PÁ§A!!

¯u¤£¦n·N«äÁÙÅý§A¥Î³oºØ¤èªk¨Ó§e²{¥X¨Ó~"~

TOP

·Q¦b½Ð°Ý¤@­Ó°ÝÃD!!!

¦pªG§Ú­n³sA3©ÎªÌ¬OA4¤]¬O¤@¼Ëªº°µªk!!¨º¬O­n¤@¼Ë½Æ»s

µM«á³o­Ó¤u§@ªí¼Ò²ÕA2§ï¦¨A3  C2 §ï¦¨ C3 ¶Ü?

TOP

¦^´_ 26# appr

¤u§@ªí¼Ò²Õ
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. Set RngA = Range("A2:A4")
  3. Set RngB = Range("B2:B4")
  4. Set RngCA = Intersect(Target, RngA)
  5. Set RngCS = Intersect(Target, RngB)
  6. If Not RngCA Is Nothing Then
  7.    RngCA.Offset(0, 2) = RngCA.Offset(0, 2) + RngCA.Value
  8.    RngCA.Value = ""
  9. End If
  10. If Not RngCS Is Nothing Then
  11.    RngCS.Offset(0, 1) = RngCS.Offset(0, 1) - RngCS.Value
  12.    RngCS.Value = ""
  13. End If
  14. End Sub
½Æ»s¥N½X

TOP

¤£¦n·N«ä!!!¤Sµo¥Í°ÝÃD¤F!!!

¤@¶}©l´ú¸Õ¬O¦nªº­«·sÃö³¬«á ¡A­«·s¨Ó¹L¤]§â«á¨Óªº¼Ò²Õ©ñ¶i¨Ó

µ²ªG"Target" ³QÅã¥Ü ¤£¥¿½Tªº¥~³¡µ{§Ç?

¬O§Ú¤@¶}©lªº¥¨¶°½s¿è¿ù»~¶Ü?

¦³ÂI·d²V¤F~"~

TOP

¦^´_ 28# appr

¥u©ñ27#ªºµ{¦¡½X
©ñ¦b¤u§@ªí¼Ò²Õ,¦p¤U¹Ï

ÁÙ¦³°ÝÃDªº¸Ü,½Ð¤W¶ÇÀÉ®×

TOP

¥i¥H¤F!!!!!!!!¹ê¦b¬O¤ÓÁÂÁ¤F~~~~~

TOP

        ÀR«ä¦Û¦b : ¤f»¡¦n¸Ü¡B¤ß·Q¦n·N¡B¨­¦æ¦n¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD