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

excel VBA calculate ªººÃ°Ý

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-5-9 13:19 ½s¿è

¦^´_ 10# shy
¨S¦³ÀÉ®×¥u¦n¥Î²qªº
Private Sub Worksheet_Calculate()  '¹w³]¤u§@ªíIJ°Ê¨Æ¥ó:   ¤u§@ªí­«ºâ¨Æ¥ó
³oµ{§Ç½X¶·¬O¦b DEE ¤½¦¡©Ò¦b¤u§@ªí¼Ò²Õ¤¤


·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  GBKEE

§Úª¾¹D­n³o¼Ë¤W¶Çªü
¦ý¬O«ö¤F¤W¶Ç«á
·|¥X²{
¹ï¤£°_¡A¤£¤ä«ù¤W¶Ç¦¹ÃþÂX®i¦Wªºªþ¥ó¡C
³o ...
shy µoªí©ó 2013-5-9 12:13

§A¥²¶·¥ý±N¬ÛÃöÀɮ׶°¤¤¡AµM«á¥þÀ£ÁY¦¨ .rar (¨Ï¥Î Winrar.exe) ÀɮסA
¤~¥i¥H¤W¶Ç ( .rar ÀÉ®×)¡C

TOP

¦^´_ 11# GBKEE

¤j­ô
³o¼Ë¦n¹³¥i¥H¤F
¦ý¬O¤S¦³·sªº°ÝÃD
²{¦bÅܦ¨¤£ºÞ¦³¨S¦³²Å¦X±ø¥ó
³£·|¥h°õ¦æµ{¦¡
µM«á³£·|¥X²{ msgBox "SUCDEDEDSUCEEDED"
®t§O¥u¬O¦b©ó¦³¨S¦³¦Û°Ê¥á³æ(²Å¦X´N·|¦Û°Ê¥á³æ, ¨S¦³²Å¦X´N¨S¦³¥á³æ....)
§Ú¥i¥H§ï¦¨
¨S¦³²Å¦X±ø¥ó==> ¤£°Ê§@
¦³²Å¦X±ø¥ó==> °õ¦æ¥á³æ°Ê§@==> ¤~¦^¶Ç msgBox "SUCDEDEDSUCEEDED"



§Ú¥i¥H½Ð±Ð§A¤@­Ó°ÝÃD¶Ü
§Ú³o­ÓÀɮ׬O¥~±µDDE
§A¨S¦³§Úªº³nÅé
¨º»ò§Ú§âÀɮפW¶Ç¨ì©³¦³¬Æ»ò·N¸q?
¦]¬°¥´¶}«á
³£¬O#N/A, ¤£µM´N¬O#REF!
¦ý¬O§Ú¦³§â§Ú¼gªºµ{¦¡½X§Ë¤W¨Óªü.....
ÁÙ¬O§A¦³¿ìªk¸Ñ¨M¥~±µDDEªº°ÝÃD??
excel VBA ¦nÃø³á...

TOP

¦^´_ 13# shy
Q:²{¦bÅܦ¨¤£ºÞ¦³¨S¦³²Å¦X±ø¥ó,³£·|¥h°õ¦æµ{¦¡,µM«á³£·|¥X²{ msgBox "SUCDEDEDSUCEEDED"
  1. Private Sub Worksheet_calculate()
  2.     'DEE ¼Æ­È¦³ÅÜ°Ê ·|°õ¦æ¦¹µ{¦¡  ********
  3.     Dim tmpResult As String
  4.     Dim OrderInfo_1 As String
  5.     tmpResult = ""
  6.     OrderInfo_1 = "" ' ¸Ì­±¬O­Ó¸ê, ¤U³æªº³]©w
  7.     tmpResult = PlaceOrderVB(OrderInfo_1)
  8.     '***************
  9.     MsgBox tmpResult  '·íµM³£·|¥X²{ msgBox "SUCDEDEDSUCEEDED"
  10.     '*************************
  11.     Application.EnableEvents = False

  12.     If Range("D4") >= 0 Then  '³o¬O§A»¡ªº ²Å¦X±ø¥ó ¶Ü??
  13.         PlaceOrderVB (OrderInfo_1)
  14.         MsgBox tmpResult  '¦pªG§Aµ{¦¡½X¸m©ó¦¹ ²Å¦X±ø¥ó ¤~·| msgBox "SUCDEDEDSUCEEDED"
  15.     End If
  16.     Application.EnableEvents = ture
  17. End Sub
½Æ»s¥N½X
Q §Ú³o­ÓÀɮ׬O¥~±µDDE,§A¨S¦³§Úªº³nÅé,¨º»ò§Ú§âÀɮפW¶Ç¨ì©³¦³¬Æ»ò·N¸q?

10#  Application.EnableEvents =true  ,ÁÙ¬O¤£·|¦Û¤v°Ê....
10#§Aªº¦^ÂÐ:¹ï§ÚÁÙ¬OÔ|µL±b.....

11# ¨S¦³ÀÉ®×¥u¦n¥Î²qªº
     Private Sub Worksheet_Calculate()  '¹w³]¤u§@ªíIJ°Ê¨Æ¥ó:   ¤u§@ªí­«ºâ¨Æ¥ó
     ³oµ{§Ç½X¶·¬O¦b DEE ¤½¦¡©Ò¦b¤u§@ªí¼Ò²Õ¤¤

½Ð°Ý§Ú11#³o¦^Âйï§A¦³À°§U¶Ü??? ¦p¦³¨º§âÀɮפW¶Ç´N¤£¥²½M¤lºN¶H!!!
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 14# GBKEE


§Ú§âÀɮ׶ǤW
¤j­ô§A¦b¬Ý¤@¤U.....

§Ú§Æ±æªº¥Ø¼Ð¬O
²Å¦X±ø¥ó(>=0)=> °õ¦æ¦Û°Ê¤U³æ(¦³¨S¦³¥X²{msgbox¨S¦³Ãö«Y..)
¤£²Å¦X±ø¥ó=>¤£­n°Ê§@,¤]¤£¥Î³qª¾..


Book3.rar (12.23 KB)
excel VBA ¦nÃø³á...

TOP

¦^´_  GBKEE


§Ú§âÀɮ׶ǤW
¤j­ô§A¦b¬Ý¤@¤U.....

§Ú§Æ±æªº¥Ø¼Ð¬O
²Å¦X±ø¥ó(>=0)=> °õ¦æ¦Û°Ê¤U³æ( ...
shy µoªí©ó 2013-5-11 15:31


¸É¥R¤@¤U
²Å¦X±ø¥ó¤@¦¸=> ¥u°õ¦æ¤@¦¸
excel VBA ¦nÃø³á...

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-5-12 18:58 ½s¿è

¦^´_ 16# shy
  1. Private Declare Function PlaceOrderVB Lib "TC_Excel_Addin.xll" (ByVal OrderInfo As String) As String
  2. Option Explicit
  3. Private Sub Worksheet_calculate()
  4.     'Static ³¯­z¦¡  ¦bµ{§Ç¼h¦¸¤¤¥Î¨Ó«Å§iÅܼƨðt¸mÀx¦sªÅ¶¡¡C¥H Static ³¯­z¦¡«Å§iªºÅܼơA¦bµ{¦¡°õ¦æ´Á¶¡¡A·|¤@ª½«O¯d¤º®e¡C
  5.     'Boolean ¸ê®Æ«¬ºA Boolean ÅܼƫY¥H 16 ¦ì¤¸( 2 ­Ó¦ì¤¸²Õ)¼Æ¦rªº§Î¦¡Àx¦s¡A¦ý¥u¯à¬O True ©Î¬O False¡CBoolean Åܼƪº­È¤£¬O True ´N¬O False
  6.     Static Msg(1 To 2) As Boolean      'µ{¦¡¤@¶}©l°õ¦æ®É,¹w³]­È¬° False
  7.     Dim tmpResult As String
  8.     Dim OrderInfo_1 As String
  9.     Application.EnableEvents = False
  10.    
  11.     '**********DEEªº¤º®e¦b³o¸Ì°õ¦æªº¥Î·N....???
  12.     tmpResult = ""
  13.     OrderInfo_1 = "" '¸Ì­±¦³­Ó¸ê,©Ò¥H¨S¦³¿ìªk¤½¶}
  14.     tmpResult = PlaceOrderVB(OrderInfo_1)
  15.     '***************************************
  16.    
  17.     '*********²q²q§Aªº·Qªk: ²Å¦X±ø¥ó¤@¦¸=> ¥u°õ¦æ¤@¦¸
  18.     If Range("D4") >= 0 And Msg(1) = False Then
  19.        '°õ¦æ¤@¦¸«á:  "D4" ¤@ª½¬O >= 0,¤£¦A°õ¦æª½¨ì "D4" < 0 «á¦b¦¸°õ¦æ
  20.         Msg(1) = True      '¤@ª½¬O >= 0
  21.         Msg(2) = False     ' < 0  ¥i°õ¦æ
  22.         
  23.         '********    ½Ð¬Ý¹Ï¥Ü   *********************
  24.         'µ{¦¡°õ¦æ´Á¶¡¡A¤@ª½«O¯d Msg(1) = True
  25.         '°£«D...µ{¦¡­«·s°õ¦æ: µ{¦¡ ¹w³]­È¬° False
  26.         '****************************************
  27.         
  28.         PlaceOrderVB (OrderInfo_1)
  29.         ' MsgBox tmpResult    °õ¦æ¦Û°Ê¤U³æ(¦³¨S¦³¥X²{msgbox¨S¦³Ãö«Y..)
  30.     ElseIf Range("D4") < 0 And Msg(2) = False Then  '²Å¦X±ø¥ó¤@¦¸=> ¥u°õ¦æ¤@¦¸
  31.         '°õ¦æ¤@¦¸«á:  ¦p"D4" ¤@ª½¬O < 0,¤£¦A°õ¦æª½¨ì "D4" >= 0 «á¦b¦¸°õ¦æ
  32.         Msg(1) = False   '>= 0 ¥i°õ¦æ
  33.         Msg(2) = True    '¤@ª½¬O < 0
  34.         PlaceOrderVB (OrderInfo_1)
  35.         ' MsgBox tmpResult    °õ¦æ¦Û°Ê¤U³æ(¦³¨S¦³¥X²{msgbox¨S¦³Ãö«Y..)
  36.     End If
  37.     Application.EnableEvents = True
  38. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 17# GBKEE


¤j­ô
§Ú¤£À´§A©Ò¿×ªº==> DEEªº¤º®e¦b³o¸Ì°õ¦æªº¥Î·N....???
§Aªº·N«ä§Ú¬°¤°»ò¥[¤J==> tmpResult= ""
§Ú¤]¤£À´ªü
§Ú¬O«ö·Ó»¡©ú®Ñ·Ó§Ûªº...

§Ú«ö¤j­ôªº¹Ï·Ó¥´
¦³¤@­Ó·sªº°ÝÃD
´N¬O¤£ºÞRange("D4") ¬O¤£¬O>=0 ³£·|¦Û°Ê°e³æ

¤j­ô§A¦³»Ý­n»¡©ú®Ñ¶Ü
http://www.touchance.com/download_file/broker/TOUCHANCE_Excel_¾Þ§@¤â¥U.pdf
³o¬Oºô§}
¤p©f§Ú¨S¦³¿ìªk¤W¶Ç
¦]¬°À£ÁY«á¤j©ó1MB
excel VBA ¦nÃø³á...

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2013-5-12 15:51 ½s¿è

¦^´_ 18# shy
TOUCHANCE»¡©ú
  1. tmpResult = PlaceOrderVB(OrderInfo)
  2. tmpResult¡G½Ð«Å§i¬°String¡A±µ¦¬¨ç¦¡¦^¶Ç­È¡C
  3. OrderInfo¡G½Ð«Å§i¬°String¡A¤º®e¬°¤U³æ¦r串¡C
  4. tmpResult數說©ú¡G
  5. ÅܼÆ
  6. »¡©ú
  7. tmpResult
  8. ±z¥i¥H§ïÅÜÅܼƦWºÙ¡A·í¤U³æ¥¢±Ñ®É·|¦^¶Ç¤@²Õ¦r¦ê¦s¤J
½Æ»s¥N½X
©Ò¥H¡A¤£»Ý¦Ò¼{§ADDEµ{§Ç
§A­n¥HD4 §@¬°¤U³æ¨Ì¾Ú
  1. Private Declare Function PlaceOrderVB Lib "TC_Excel_Addin.xll" (ByVal OrderInfo As String) As String
  2. Option Explicit

  3. Private Sub Worksheet_calculate()

  4. Dim tmpResult As String
  5. Dim OrderInfo_1 As String  '¤U³æªº°Ñ¼Æ

  6. OrderInfo_1 = "" '¸Ì­±¦³­Ó¸ê,©Ò¥H¨S¦³¿ìªk¤½¶}
  7. '³oÀ³¸Ó¬O§A¤U³æªº°Ñ¼Æ

  8. If Range("D4") >= 0 Then
  9. Application.EnableEvents = False
  10. tmpResult = PlaceOrderVB(OrderInfo_1) '°õ¦æ§A©Ò¿×ªº¤U³æ°Ê§@
  11. MsgBox "Run PlaceOrderVB OK!¡G" & tmpResult  '¦pªG¦³°õ¦æ´N·|¥X²{¦¹Äµ¥Üµøµ¡
  12. Application.EnableEvents = True
  13. End If
  14. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 19# Hsieh

¤j­ô
§Ú¥Î§A«Øijªº¤è¦¡¸Õ¤F¤@¤U
¦³¤@­Ó°ÝÃD
¥´¶}Àɮ׮ɷ|°õ¦æ¤@¦¸¦Û°Ê°e³æ
µM«á·|¥X²{msgBox
«ö½T©w«á
·|¦A°õ¦æ¤@¦¸¦Û°Ê°e³æ
¦ý´N¤£·|¥X²{msgBox¤F...

¤]´N¬O³£·|°õ¦æ¨â¦¸...
excel VBA ¦nÃø³á...

TOP

        ÀR«ä¦Û¦b : ¡i°±º¢¤£«e¡A²×µL©Ò±o¡j¤H³£°g©ó´M§ä©_ÂÝ¡A¦]¦Ó°±º¢¤£«e¡FÁa¨Ï®É¶¡¦A¦h¡B¸ô¦Aªø¡A¤]¤FµL¥Î³B¡A²×µL©Ò±o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD