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

[µo°Ý] Ãö©ó¤u§@ªíªºcalculate¨Æ¥ó

[µo°Ý] Ãö©ó¤u§@ªíªºcalculate¨Æ¥ó

¦U¦ì¤j¤j¡A¤£¦n·N«ä¡A§Ú³oÃ䦳­Ó°ÝÃD·QÀµ¨D·|ªºµ¹§Ú«üÂI°g¬z¡A
¤@¯ë¨ÓÁ¿¡A¤u§@ªíªºcalculate­n¥ý¦b¨º­Ó¤u§@ªíªºµ{¦¡½Xµøµ¡¼g¤W¨Æ¥ó¡A
µM«á·í¤½¦¡¼Æ­È§ïÅܮɡA´N·|IJµocalculate¨Æ¥ó¡A

­Y§Ú²{¦b­n¦bn­Ó¡]¤]´N¬O¤£½T©wªº¤u§@ªí¼Æ¡^¡A
¦b¨C­Ó¸Ì­±³£¼g¤W¤@¼Ëªºcalculate¨Æ¥ó¡A
¦³¿ìªk¥Î¤@¯ë¼Ò²Õ©ÎªÌVBAªº¨ä¥L¥\¯à¡BÅܼƨº¨Çµ¥µ¥¡A
¨Ï¥L¦Û°Ê¶ñ¤J¶Ü¡H

³Â·Ð¦U¦ì¤F
ÁÙ¬O³o­Ó¬O¨S¿ìªk¥Îµ{¦¡¼gªº¡AÁÂÁÂ

¦^´_ 1# lin_6219
§ï¦¨¼g¦bThisWorkbook¤¤ªºSheetCalculate¨Æ¥ó¬Ý¬Ý¡C

TOP

¦^´_ 2# stillfish00
¦n¡A §Ú¥ý¸Õ¬Ý¬Ý ·PÁ§A:)))

TOP

¦^´_ 2# stillfish00
§Ú¥i¯à§â§Úªº·N«äªí¹F¿ù¤F¡A
À³¸Ó³o¼ËÁ¿¡A§Ú­n°õ¦æªºcalculate¡A¬O­nIJµo¥¦¥hµe°ÊºAªº¹Ïªí¡A
¦ý¬O¨C­Ó¤u§@ªíªº¸ê®Æ¤£¦P¡A¦pªG¥ÎSheetCalculate³o­Ó¤èªk¡A
·|Åý¥ô¦ó¤@±i¤u§@ªíªº¤½¦¡­È§ïÅÜ¡A´N¥hIJµo³o­Ó¨Æ¥ó¡A
³o¼Ë·|¤£·|¤Ó¯Ó®Ä¯à¡A¦³¨S¦³¨ä¥L¤èªk¡A©êºp³á¡A
§Úªí¹F¤£¤Ó¦n¡A¦ý³o­Ó°ÝÃD§Ú¯uªº·Q¤£³z¡C·PÁÂ

TOP

¦^´_ 4# lin_6219
¸Ó¨Æ¥ó¦³±a°Ñ¼ÆSh¡A»¡©ú¬O­þ­Ó¤u§@ªíIJµoªº¡A
¥Î¥L§PÂ_¬O¤£¬O§A«ü©wªº¤u§@ªíIJµoªºÀ³¸Ó´N¥i¥H¤F¡A¦p¤U¡C
µM«á§Ú¤£¾å±o§Aªº°ÊºA¹Ïªí¬O¦p¦ó¹F¦¨¡H ¤@¯ë¦n¹³³£¬O¥Î©w¸q¦WºÙ¥h±±¨î§a¡C
  1. Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
  2.     Select Case Sh.Name
  3.     Case "¤u§@ªí11", "¤u§@ªí12"
  4.         MsgBox "µe°ÊºAªº¹Ïªí??"
  5.     Case Else
  6.         MsgBox "¤°»ò³£¤£°µ"
  7.     End Select
  8. End Sub
½Æ»s¥N½X

TOP

¦^´_ 5# stillfish00
®¦®¦¡A¦nªº¡A§Ú¥ý¸Õ¬Ý¬Ý¡A«D±`·PÁ§Aªº¸ÑÄÀ¡AÁÂÁ¡C

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-6-15 07:54 ½s¿è

¦^´_ 1# lin_6219
¬Ý¤F§A¼Æ¤éªº°Q½×¦¨ªG¡AÁÙ¬Oµ¹§A­Ó´£¥Ü§a¡A­n¥[ªoËç¡I
«ä¦Ò°ÝÃD­n¦h¤èªºÅçÃÒ¤ÎÆ[¹î¡A¥H´Á¯à¤Á¤J¨ì¯u¥¿ªº°ÝÃD®Ö¤ß¡C
IJµo°õ¦æµe°ÊºAªº¹Ïªí¡G
  1. Option Explicit

  2. Dim timerEnabled As Boolean        '   §P©w¶}±Ò¥»¤u§@ªí³æªº®É¬q¬O§_¬°¶}½L«e±Ò°Ê¡C
  3. Private Sub Workbook_Open()
  4.     KChartWithVolume                        '   ¥H§A¦Û¤vªº K ¹Ï°µ¬°¨ÒÃÒ
  5.     '   ¨C³{¬P´Á¤»¡B¤é °£¥~¡A ¦Û°Ê±Ò°Ê­p®É¾¹
  6.     If Weekday(Date, 2) <= 5 Then Call timerStart
  7. End Sub

  8. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  9.     On Error Resume Next
  10.     Application.OnTime Now + TimeValue("00:00:01"), "ThisWorkbook.inProcess", , False
  11.     Me.Save
  12. End Sub

  13. Sub timerStart()
  14.     If timerEnabled Then
  15.         ' ²Ä¤G¦¸(§t)¥H«á§¡¥H³]©w¤§ "¶¡¹j®É¬q" ¨Ó³B²z°õ¦æ§Çªº§@·~¡C (¥»¨Ò¥H¨C¤­¤ÀÄÁ°õ¦æ¤@¦¸)
  16.         Application.OnTime (Now + TimeValue("00:05:00")), "ThisWorkbook.inProcess"
  17.     Else
  18.         timerEnabled = True
  19.         
  20.         If (TimeValue(Now) <= TimeValue("08:45:00")) Then
  21.             Application.OnTime (TimeValue("08:45:00")), "ThisWorkbook.inProcess"
  22.         Else
  23.             ' ¨t²Î­è³s¤W DDE ¦Ü¸ê®Æ¶×¤JExcel¤u§@ªí³æ¡A¶·¦³¤@­Ó½w½Ä®É¬q¡A
  24.             ' ³o®É¦pªG°¨¤W¥h§ì¨úDDE¸ê®Æ¡A·|¦³«¬ºA¤£²Åªº¿ù»~°T®§²£¥Í¡A¨Ã¤¤Â_°õ¦æ§Çªº§@·~¡C
  25.             Application.OnTime (Now + TimeValue("00:00:05")), "ThisWorkbook.inProcess"
  26.         End If
  27.     End If
  28. End Sub

  29. Private Sub inProcess()
  30.     On Error Resume Next
  31.     If (TimeValue(Now) < TimeValue("08:45:00") Or TimeValue(Now) > TimeValue("13:46:01")) Then Exit Sub
  32.    
  33.     ' ½L¤¤³B²z¡A±N¸ê®Æ¶×¤J¼g¤J¤u§@ªí³æ¤ºÀx¦s¡C

  34.     With Sheets("¥Dµe­±")
  35.         ' . . . . .
  36.         ' . . . . . (¼g¤JDDE¶×¤J¤§¬ÛÃö¸ê®Æ))
  37.         ' . . . . .
  38.     End With
  39.         
  40.     Call getKLastMove()     '  Ä²µo°õ¦æµe°ÊºAªº¹Ïªí
  41.     Call timerStart
  42. End Sub

  43. Sub getKLastMove()
  44.     Dim totalRows As Long
  45.    
  46.     With Worksheets("¥Dµe­±")
  47.         .Select
  48.         totalRows = Worksheets("ø¹Ï¸ê®Æ").Range("A" & .Rows.Count).End(xlUp).Row
  49.         ActiveSheet.ChartObjects.Select
  50.         With ActiveChart
  51.             .SetSourceData Source:=Range("ø¹Ï¸ê®Æ!$A$2:ø¹Ï¸ê®Æ!$E$" & CStr(totalRows) & ", ø¹Ï¸ê®Æ!$G$2:ø¹Ï¸ê®Æ!$G$" & CStr(totalRows) &  _
  52.                                          ", ø¹Ï¸ê®Æ!$F$2:ø¹Ï¸ê®Æ!$F$" & CStr(totalRows))
  53.             .SeriesCollection(1).Name = "=ø¹Ï¸ê®Æ!$B$1"           ' ¶}½L»ù
  54.             .SeriesCollection(2).Name = "=ø¹Ï¸ê®Æ!$C$1"           ' ³Ì°ª»ù
  55.             .SeriesCollection(3).Name = "=ø¹Ï¸ê®Æ!$D$1"           ' ³Ì§C»ù
  56.             .SeriesCollection(4).Name = "=ø¹Ï¸ê®Æ!$E$1"           ' ¦¬½L»ù (¦¨¥æ»ù)
  57.             .SeriesCollection(5).Name = "=ø¹Ï¸ê®Æ!$G$1"           ' ²¾°Ê¥­§¡½u
  58.             .SeriesCollection(5).Name = "¦¨¥æ¶q"                   ' ¦¨¥æª÷ÃB
  59.         End With
  60.     End With
  61. End Sub

  62. Sub KChartWithVolume()                         '  K½u¹Ï»P¦¨¥æ¶q¹Ï©ñ¦b¦P¤@¹Ïªí
  63.     ' . . . . .
  64.     ' . . . . .  (K½u¹Ï»P¦¨¥æ¶q¹Ï)
  65.     ' . . . . .
  66. End Sub
½Æ»s¥N½X
¦h¸ò¾Ç®Õ±Ð±Â¤Î¦P¾Ç­Ì¬Û¤¬½Ð¯q¡C

TOP

¦^´_ 7# c_c_lai
®¦®¦¡A¯uªº«Ü·PÁ§A³á¡A§Ú¥Ø«e¾ÇVBA¤~¤»¤C­Ó¤ë§a¡A
¥u¹ï°ò¦·§©À²¤ª¾¡A¦ýÁÙ¤£¬O«D±`©ú¥Õ¡A
¥Ø«e§Úªº³o­Ó°ÝÃDºâ¬O¸Ñ¨M¤F¡A
¦ý¦A©I¥s¹Ïªí¤WÁÙ¦³«Ü¤jªº°ÝÃD¡A
§Ú¥ý¦A¦n¦n«ä¦Ò¬ã¨s¡A«D±`·PÁ§Aªº¤À¨É¡A§Ú·|§V¤Oªº¡C

TOP

¦^´_ 8# lin_6219
­º¥ý­n¥ý¥hÁA¸Ñ¤Î¼ô±x F8 (Debug) ªºÀ³¥Î¡A
³z¹L F8 §A¦A¥h°lÂÜ Local Variables ­ÈªºÅܤơA
¥H¤Î§Q¥Î "ºÊ¬Ý¦¡" µøµ¡ "¹Bºâ¦¡" Æ[¹î¥Ø«e¤§
Runtime Values¡A ¦p¦¹§A¥i¥H±q¤¤¥hÅé·|µ{¦¡
§¹¾ã°õ¦æ¹Lµ{¡B¥H¤Î°ÝÃDµo¥Í¿ù»~ªº­ì¦]¡C

TOP

¦^´_ 9# c_c_lai
®¦®¦¡A ¦nªº ·PÁ§A:)))

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD