If (Cells(1, 3) = "") Then
Cells(1, 3) = Cells(1, 1)
ElseIf (Cells(2, 3) = "") Then
Cells(2, 3) = Cells(1, 1)
Else
startrow = Range("c1").End(xlDown).Row + 1
Cells(startrow, 3) = Cells(1, 1)
End If
Application.OnTime Now + TimeValue("00:01:00"), "test"
End Sub作者: JasonChen576 時間: 2018-1-29 07:57
Sub Sb每分鐘紀錄更新()
Dim mySht來源 As Worksheet
Set mySht來源 = Worksheets("資料來源")
Dim myRng來源 As Range
Set myRng來源 = mySht來源.Range("A1")
Dim mySht紀錄 As Worksheet
Set mySht紀錄 = Worksheets("每分鐘紀錄資料")
Dim myRng紀錄時間 As Range
Set myRng紀錄時間 = mySht紀錄.Range("A1")
Dim myRng紀錄資料 As Range
Set myRng紀錄資料 = mySht紀錄.Range("B1")
Dim myMinute As Integer
myMinute = Minute(Time)
myRng紀錄時間 = Time
myRng紀錄資料 = myRng來源
i = 0
Do
DoEvents
If myMinute <> Minute(Time) Then
i = i + 1
myRng紀錄時間.Offset(i, 0) = Time
myRng紀錄資料.Offset(i, 0) = myRng來源
myMinute = Minute(Time)
End If
Loop
End Sub