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

[µo°Ý] ¼W¥[dde¨Ó·½ °ÝÃD

[µo°Ý] ¼W¥[dde¨Ó·½ °ÝÃD

¥»©«³Ì«á¥Ñ susamws ©ó 2010-9-3 16:49 ½s¿è

¦U¦ì«e½ú±z­Ì¦n
­º¥ý¥ý·PÁ¨F¤j¤À¨Éªº¤å³¹»P°Ñ¦Ò. ¤~¦³¶i¤@¨BªºÁA¸Ñ
°ÝÃD¡G¥Ñ©ósheet1 ¦³A1 dde¨Ó·½, ·Q¦A¼W¥[§Oªº¨Ó·½¦ÜB2 C2..... ¨Ã¦P¼Ë½Æ»s¨ìsheet2 C, D¸Ì­±
½Ð°Ý«e½ú­Ì ¸Ó»yªk¸Ó«ç»ò¤U©O¡H ¸Õ¤F«Ü¦h¼gªk³£¿ù»~...
¦p¤UÂŦâ½X¡G

Option Explicit
Const CTIME As String = "0:0:3"
Private nextruntime As Date
Private timerisrunning As Boolean

Sub Start_Timer()
    If Not timerisrunning Then
        nextruntime = Now() + TimeValue(CTIME)
        timerisrunning = True
        Application.OnTime EarliestTime:=nextruntime, _
            Procedure:="GetData", Schedule:=True
    End If
End Sub

Private Sub GetData()
    Dim rng As Range
    Set rng = Sheets("Sheet2").Range("B65536").End(xlUp).Offset(1, 0)
    rng = Sheets("Sheet1").Range("A1")

    rng.Offset(0, -1) = Time
    timerisrunning = False
    Start_Timer
End Sub


Sub Stop_Timer()
    If timerisrunning Then
    Application.OnTime EarliestTime:=nextruntime, _
        Procedure:="GetData", Schedule:=False
    timerisrunning = Not timerisrunning
    End If
End Sub

Private Sub auto_close()
    Stop_Timer
End Sub


¹³¤W¹Ï³o¼Ë¶Ü¡H
§â§A¤W¹Ï¶Kªºµ{¦¡½X¡A³o³¡¤À
  1.     Set rng = Sheets("Sheet2").Range("B65536").End(xlUp).Offset(1, 0)
  2.     rng = Sheets("Sheet1").Range("A1")
  3.     rng.Offset(0, -1) = Time
½Æ»s¥N½X
§ï¦¨©³¤U³o¼Ë¸Õ¸Õ¬Ý
  1.     Set rng = Sheets("Sheet2").Range("A65536").End(xlUp).Offset(1, 0).Resize(1, 4)
  2.     With Sheets("Sheet1")
  3.       rng = Array(Time, .[A1], .[B2], .[C2])
  4.     End With
½Æ»s¥N½X
¤@§Z¤T¥|¡BÅå¨ìåF¥N»x

TOP

        ÀR«ä¦Û¦b : §ïÅܦۤv¬O¦Û±Ï¡A¼vÅT§O¤H¬O±Ï¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD