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

[µo°Ý] ®É¶¡¨ç¼Ænow ¦Û°Ê§ó·s°ÝÃD

[µo°Ý] ®É¶¡¨ç¼Ænow ¦Û°Ê§ó·s°ÝÃD

½Ð°Ý¦U¦ì¤j¤j¡A¨Ï¥Î®É¶¡¨ç¼ÆNOW()¡A¿é¤J«á¥H·í¤U¬í¼Æ¬°¬ö¿ý
¨Ï¥ÎVBA»yªk¨ÏNOW()¦Û°Ê§ó·s¡A
·Q½Ð°Ý¦p¦óÅý§ó·s®É¶¡¬°¨C¤ÀÄÁªº²Ä¤@¬í
  1. Private Sub Workbook_Open()
  2.   AA
  3. End Sub

  4. Sub AA()
  5.   Sheets("DATA").Range("A1").Value = Now
  6.   Application.OnTime Now + TimeValue("00:00:30"), "AA"
  7. End Sub
½Æ»s¥N½X

1621645773296.jpg (10.94 KB)

1621645773296.jpg

¦^´_ 1# wvsx


  ¤£¦n·N«ä¡A¤£¤Ó¤F¸Ñ§Aªº»Ý¨D¡A¥i§_¸ÑÄÀ¸Ô²Ó¤@ÂI¡AÁÂÁ¡C

TOP

¥»©«³Ì«á¥Ñ wvsx ©ó 2021-5-22 10:17 ½s¿è

¦^´_ 2# samwang


·í¿é¤JNOW()¨ç¼Æ¡A·|¥H·í¤U¿é¤JNOW()ªº®É¶¡¬°¬ö¿ý¡A¦p¹Ï¤Wªº¬í¼Æ
¥HVBA³]©w¬°30¬í¦Û°Ê§ó·s
¦p¹Ï¤W¿é¤J·í¤U®É¶¡¬°¢¯¢¸ÂI¢¯¢¸¤À¢±¢´¬í¡A¢²¢¯¬í«á¦Û°Ê§ó·s¬°¢¯¢¸ÂI¢¯¢¸¤À¢´¢´¬í
·QÅý¥¦¤U¦¸¦Û°Ê§ó·s®É¶¡¬°¢¯¢¸ÂI¢°¢¯¤À¢¯¢¯¬í
¥H¦¹Ãþ±À¡A«áÄò§ó·s³£¬O¦b¾ã¤À¢¯¢¯¬í
½Ð°Ý¸Ó¦p¦ó³]©w

TOP

Application.ontime

https://docs.microsoft.com/zh-tw/office/vba/api/excel.application.ontime
·s¤â¤W¸ô¡A½Ð¦h¥]²[¡C

TOP

Sub AA()
  Sheets("DATA").Range("A1").Value = Now
  If Sheets("DATA").Range("B1").Value = "Stop" Then Stop
  
  Application.OnTime Format(Now + 1 / 24 / 60, "HH:MM"), "AA"
End Sub
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

        ÀR«ä¦Û¦b : ¥¬¬I¦p¼½ºØ¡A¥HÅw³ß¤ß´þ¼íºØ¤l¡A¤~·|µoªÞ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD