[VBA ] 錯誤1004

作者: s3bck (周公)   2014-07-08 10:44:01
我嘗試更改了別人的code
但每次執行到一半 都會出現錯誤1004
請問要如何更改?
Btw 我是要寫一個看盤程式
當某一 column值=1 紀錄那一整 Row
以下是code:
Public uMode&, StartTime, EndTime
Public MyBook As Workbook, Sht1 As Worksheet, Sht2 As Worksheet, xRow&, xColumn&
...
Sub 自動記錄
If uMode = 0 Then Exit Sub
If Time > TimeValue(EndTime) Then
Sht1.[J1] = "已過收盤時間"
uMode = 0
Exit Sub
End If
Sht10Range("K1") = Time
'這邊都還沒問題 以下是更改的地方
Dim c As Interger
For c =2 To 30
If Cells(c,10) = 1 Then
xRow = Sht2.Range("A66536").End(x1UP).Row + 1
'下面這行會出現錯誤1004
Sht2.Range("A" & xRow & ":K" & xRow).Value = Sht.Range(Cells(c,1), Cells(c,10)).Value
Sht2.Range("K" & xRow).Value = Time
ThisWorkbook.Save
Beep
End If
Next
Application.OnTime Now + TimeValue("00:00:05"), "自動記錄"
End Sub
不吝賜教 感激不盡
作者: Marty (DNA探針)   2014-07-08 12:51:00
Sht2.Ranfe("K" & xRow).Value = Time 'Ranfe? 打錯字?
作者: Catbert (宅男)   2014-07-08 20:54:00
Cells(c,1).address, Cells(c,10).address

Links booklink

Contact Us: admin [ a t ] ucptt.com