你必須在代碼中指定工作表。
Sub yy()
with sheet1
ar = Array(.[A1], .[B1], .[C1], .[D1], .[E1], .[F1], .[G1], .[H1], .[I1], .[J1])
.[A65536].End(xlUp).Offset(1, 0).Resize(, 10) = ar
Application.OnTime Now + TimeSerial(0, 0, 10), "yy"
end with
End Sub
---------------------------
Sub xx()
with sheet2
ar = Array(.[A1], .[B1], .[C1], .[D1], .[E1], .[F1], .[G1], .[H1], .[I1], .[J1])
.[A65536].End(xlUp).Offset(1, 0).Resize(, 10) = ar
Application.OnTime Now + TimeSerial(0, 1, 0), "xx"
end with
End Sub作者: junsean 時間: 2010-10-19 12:20
回復 10#junsean
If Time <= TimeValue("08:59:00") Then
Range("A3:I50000") = "" '第一次條件成立時執行 如此
ElseIf Time >= TimeValue("09:00:00") And Time <= TimeValue("13:32:30") Then
ar = Array([A2], [B2], [C2], [D2], [E2], [F2], [G2], [H2], [I2]) '只有9個元素
[A65536].End(xlUp).Offset(1, 0).Resize(, 10) = ar
Application.OnTime Time + TimeSerial(0, 0, 10), "yy" '這裡就不執行了
End If
Sub yy()
With Sheet1
If Time <= TimeValue("08:59:00") Then
.Range("A3:I50000") = ""
Application.OnTime TimeSerial(9, 0, 0), "yy"
End If
If Time >= TimeValue("09:00:00") And Time <= TimeValue("13:32:30") Then