我正在尝试删除选择范围并向上移动其余单元格,但始终陷于以下错误
运行时错误“ 1004”:
无法调试“ Range类的删除方法失败”
我看不出我到底在做什么错,会感激任何指针。
Mainfile = "Travelex Order.xls"
SecFile = "EURUSD.xls"
SheetOne = "Bulk Order"
SheetTwo = "EURUSD Breakdown"
SheetThree = "PDF Gen2"
SheetFour = "EURUSD"
SheetFive = "Rate Check"
Workbooks(Mainfile).Worksheets(SheetOne).Range("A23:C96").Copy
Workbooks(Mainfile).Worksheets(SheetFive).Range("A2").PasteSpecial Paste:=xlPasteValues
Count = 2
Do
If Workbooks(Mainfile).Worksheets(SheetFive).Range("A" & Count).Value <> "" And Workbooks(Mainfile).Worksheets(SheetFive).Range("B" & Count).Value = "" And Workbooks(Mainfile).Worksheets(SheetFive).Range("C" & Count).Value = "" Then
Workbooks(Mainfile).Worksheets(SheetFive).Range("A" & Count & ":C" & Count).Delete Shift:=xlToUp
End If
Count = Count + 1
Loop Until Count > 80
我尝试进行以下更改,但是没有运气
Workbooks(Mainfile).Worksheets(SheetFive).Range("A" & Count & ":C" & Count).Delete Shift:=xlToUp
到
Range("A" & Count & ":C" & Count).Delete Shift:=xlToUp
我总是在那一行上出错。
答案 0 :(得分:0)
我已经弄错了Rory所说的语法,应该是xlUp。