这是委员会报告的一串代码。它每天运行良好,零问题,最后一次运行是在 13 日。
今天早上我收到一个Run Time Error 13 Type Mismatch
.
我不知道为什么,但是当我调试时,它会突出显示此部分:
If UCase(Cells(i, 1).Value = "200265 - MP"
然后
我试图重新输入它,但是当我这样做时,我得到一个错误的单词 Then 说明如下:
Compile error: Expected: list seperator or )
我怎么能运行这个?
这是代码:
Sheets("Errors").Select
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sheets("Errors").Select
With Sheets("Errors")
lastrow = .Range("C" & Rows.Count).End(xlUp).Row
End With
For i = lastrow To 1 Step -1
Cells(i, 1).Select
If UCase(Cells(i, 1).Value = "200265 - MP" Then
Rows(i).Select
Selection.Cut
Sheets("Temp").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Sheets("Errors").Select
End If
If UCase(Cells(i, 1).Value) = "160850 - TP" Then
Rows(i).Select
Selection.Cut
Sheets("Temp").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Sheets("Errors").Select
End If
If UCase(Cells(i, 1).Value) = "170566 - VB" Then
Rows(i).Select
Selection.Cut
Sheets("Temp").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Sheets("Errors").Select
End If
If UCase(Cells(i, 1).Value) = "201447 - JB" Then
Rows(i).Select
Selection.Cut
Sheets("Temp").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Sheets("Errors").Select
End If
If UCase(Cells(i, 1).Value) = "202006 - BL" Then
Rows(i).Select
Selection.Cut
Sheets("Temp").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Sheets("Errors").Select
End If
If UCase(Cells(i, 1).Value) = "203646 - MM" Then
Rows(i).Select
Selection.Cut
Sheets("Temp").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Sheets("Errors").Select
End If
If UCase(Cells(i, 1).Value) = "203917 - KT" Then
Rows(i).Select
Selection.Cut
Sheets("Temp").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Sheets("Errors").Select
End If