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

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

¦^´_ 10# leefing

DDE³sµ²ÅÜ°Ê¡A¥u¯àIJµo Worksheet_Calculate¨Æ¥ó
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

°£¤F¨Ï¥Î Worksheet_Calculate¨Æ¥ó
ÁÙ¦³¤@­Ó SetLinkOnData ¤èªk

TOP

¦^´_ 11# Hsieh


    ©Ò¥H¥u­n§âchange§ï¦¨Calculate,   ³o¼Ë´N¥i¥H¤F¶Ü¡H

TOP

¦^´_ 12# kobo

K¤j¡ASetLinkOnData³o­Ó¤èªk¡A¦bEXCEL»¡©ú ¨Ã¤£¤Ó²M·¡(¤p§Ì¤£¤ÓÀ´¤W­±ªº·N«ä)¡A¬O¤£¬O­n°µ¤j§ï³y¤F¡H¡H

TOP

¦^´_ 12# kobo

EXCEL¤¤¬O§Q¥ÎWorksheet_Calculate¨Æ¥ó
³z¹LSetLinkOnData ¤èªk¨ÓÅX°Ê©Ò­n°õ¦æªºµ{§Ç
©Ò¥HÁÙ¬O³z¹LCalculate¨Ó®·®»DDEªº§ïÅÜ
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ leefing ©ó 2012-2-11 00:15 ½s¿è

¦^´_ 11# Hsieh

H¤j¡A§Ú¤j·§¼g¦n¤F¡A¦³±µ¤@¤UDDE  ·|¸õ°Ê¡A¥i¥HÀ°§Ú¬Ý¬Ý«ç¼Ë¤~·|§¹¬ü©ÎªÌ ³Ì¨Î
  1. Private Sub Worksheet_Calculate()
  2. Dim buy As Integer
  3. Dim short As Integer

  4. If Range("J2") >= 10 Then
  5. short = Range("Y2") 'ªÅ
  6. buy = Range("X2") '¦h
  7.     If (Range("F2") = Range("D2")) Then     '¦¨¥æ=¶R¶i  °O¦bªÅ
  8.         Range("Y2") = Range("J2") + short
  9.     End If
  10.     If (Range("F2") = Range("E2")) Then     '¦¨¥æ=½æ¥X °O¦b¦h
  11.         Range("X2") = Range("J2") + buy
  12.     End If
  13.     If (Range("F2") > Range("D2")) And (Range("F2") > Range("E2")) Then
  14.         Range("X2") = Range("J2") + buy '¦¨¥æ¤j©ó¶R¶i©M½æ¥X   °O¦b¦h
  15.     End If
  16.     If (Range("F2") < Range("D2")) And (Range("F2") < Range("E2")) Then
  17.         Range("Y2") = Range("J2") + short '¦¨¥æ¤p©ó¶R¶i©M½æ¥X  °O¦bªÅ
  18.     End If
  19. End If
  20. End Sub
½Æ»s¥N½X
¨º§Ú¹j¤Ñ­n­«·s­pºâ¡A¨º­n«ç»òÄÀ©ñ¡H ¼g¤@­Ó«ö¶s ÂIÂk¹s¶Ü¡H

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2012-2-11 23:55 ½s¿è

¦^´_ 16# leefing
§Ú¥u¦³yeswin¸Õ¥Îª©
°²³][J12]ªºDDE³sµ²¤½¦¡=YES|DQ!EXFB2.Volume
´£¨Ñ§A´ú¸Õ¬Ý¬Ý
¦bSheet1¼Ò²Õ¼W¥[Worksheet_Calculateµ{§Ç
  1. Private Sub Worksheet_Calculate()
  2. ThisWorkbook.SetLinkOnData "YES|DQ!EXFB2.Volume", "Catch_DDE"
  3. End Sub
½Æ»s¥N½X
¦b¤@¯ë¼Ò²Õ
  1. Sub Catch_DDE()
  2. MsgBox "J1¼Æ­ÈÅÜ°Ê"  '¦¹¦æ´ú¸Õ¬O§_J12ªºDDE§ó·s¡A¥i¨ú®ø
  3. With Sheet1
  4. If .[J12].Value >= 10 Then
  5.    If .[D12] = .[F12] Then .[U12] = .[U12] + .[J12]
  6.    If .[E12] = .[F12] Then .[T12] = .[T12] + .[J12]
  7. End If
  8. End With
  9. End Sub

  10. Sub Auto_Open() '¶}Àɮɦ۰ʰõ¦æ
  11. With Sheet1
  12. .[U12:T12] .ClearContents
  13. End With
  14. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 17# Hsieh


    H¤j¡A¶}±ÒEXCELªº®É­Ô¡A
If .[J12].Value >= 10 Then
³o¤@¦æ¡A¥X²{¸ê®Æ«¬ºA¤£²Å¡A¬O¦]¬°¨S¦³©w¸q¶Ü¡H
§Ú§â¥¦«ö°»´ú¡AµM«áÃö³¬¡A¦A«ö¶}©l¥¨¶°¡A´N¥i¥H¶}©l¹B§@¤F¡C

TOP

¦^´_ 18# leefing
³o¥i¯à¬O¶}±ÒÀɮ׮ɡADDEÁÙ¨S³s¤W®É¡A[J12]¥X²{#N/Aªº¿ù»~©Ò­P
Sub Catch_DDE()
MsgBox "J1¼Æ­ÈÅÜ°Ê"  '¦¹¦æ´ú¸Õ¬O§_J12ªºDDE§ó·s¡A¥i¨ú®ø
With Sheet1
If IsError(.[J12]) Then Exit Sub
If .[J12].Value >= 10 Then
   If .[D12] = .[F12] Then .[U12] = .[U12] + .[J12]
   If .[E12] = .[F12] Then .[T12] = .[T12] + .[J12]
End If
End With
End Sub
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 19# Hsieh


    H¤j¡A
If IsError(.[J12]) Then Exit Sub
³o¤@¦æ «ç»ò¥[¤£¤W¥h¡A¥X²{½sĶ¿ù»~:  ¥²¶·¬O:³¯­z¦¡µ²§À¡C
then¥X²{¶À©³

¥ý¶}³nÅé¦A¶}EXCEL  ¤]·|¥X²{«¬ºAªº°ÝÃD¡A ¬O¦]¬°DDE³sªº¨S¦³EXCEL§Ö¶Ü¡H(¤@¶}©lªº®É­Ô)

TOP

        ÀR«ä¦Û¦b : ¨C¤ÑµL©Ò¨Æ¨Æ¡A¬O¤H¥Íªº®ø¶OªÌ¡A¿n·¥¡B¦³¥Î¤~¬O¤H¥Íªº³Ð³yªÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD