作者s3bck (周公)
看板Visual_Basic
标题[VBA ] 错误1004
时间Tue Jul 8 10:44:01 2014
我尝试更改了别人的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
不吝赐教 感激不尽
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 163.29.100.186
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/Visual_Basic/M.1404787445.A.1CB.html
1F:推 Marty:Sht2.Ranfe("K" & xRow).Value = Time 'Ranfe? 打错字? 07/08 12:51
谢谢
※ 编辑: s3bck (163.29.100.186), 07/08/2014 13:29:20
2F:推 Catbert:Cells(c,1).address, Cells(c,10).address 07/08 20:54