报错:loop没有do,我看了好多次,没看出来
Do While MyFile <> ""
Workbooks.Open Filename:=Mypath & MyFile
Sheets(1).Select
i = 13
k = 1
'find the filter line
Do While k < 50
If InStr(ActiveSheet.Cells(k, 6).Value, "Screen") <> 0 Then
i = k + 3
Exit Do
End If
k = k + 1
Loop
Do While ActiveSheet.Cells(i, 6) <> "" Or ActiveSheet.Cells(i, 7) <> "" Or ActiveSheet.Cells(i, 8) <> ""
If ActiveSheet.Cells(i, 10) = "1" Then
If Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 1) = "" Then
Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 1) = ActiveSheet.Cells(i, 6)
Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 2) = ActiveSheet.Cells(i, 7)
Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 4) = ActiveSheet.Cells(i, 24)
Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, TranslaterColumn) = ActiveSheet.Cells(i, 42)
Else
If Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 1) <> ActiveSheet.Cell(i, 6) Then
MsgBox ("Error! ID " & Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 1) & " is not match with The translater books.")
Exit Do
End If
j = j + 1
End If
i = i + 1
Loop ‘这个位置报loop没有do的错误
MyFile = Dir()
Loop
我已经检查了,即是否遗漏end语句,我看没有遗漏,所以求高手指点,不胜感激 VBA????报错
[解决办法]
楼主会不会少了个end if
[解决办法]
If ActiveSheet.Cells(i, 10) = "1" Then
If Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 1) = "" Then
Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 1) = ActiveSheet.Cells(i, 6)
Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 2) = ActiveSheet.Cells(i, 7)
Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 4) = ActiveSheet.Cells(i, 24)
Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, TranslaterColumn) = ActiveSheet.Cells(i, 42)
Else
If Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 1) <> ActiveSheet.Cell(i, 6) Then
MsgBox ("Error! ID " & Workbooks("PSAFinalString.xls").Sheets("TranslaterPSA").Cells(j, 1) & " is not match with The translater books.")
Exit Do
End If
j = j + 1
End If