albert211994
New Member
- Joined
- Feb 7, 2017
- Messages
- 10
Here are my code:
I'm getting an error "Next without For".
Can any body help me with regards with this error. Why I am getting this?
Code:
Sub GL()With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Dim i As Integer
For i = 2 To 20000
If Trim(ThisWorkbook.Sheets("FRA&FFC").Cells(i, 6).Text) <> "" Then
If Trim(ThisWorkbook.Sheets("FRA&FFC").Cells(i, 6).Text) = "Z002" Then
If (ThisWorkbook.Sheets("FRA&FFC").Cells(i, 5).Text) = "200290" Or _
(ThisWorkbook.Sheets("FRA&FFC").Cells(i, 5).Text) = "200410" Or _
(ThisWorkbook.Sheets("FRA&FFC").Cells(i, 5).Text) = "200422" Or _
(ThisWorkbook.Sheets("FRA&FFC").Cells(i, 5).Text) = "200469" Or _
(ThisWorkbook.Sheets("FRA&FFC").Cells(i, 5).Text) = "200748" Then
ThisWorkbook.Sheets("FRA&FFC").Cells(i, 18).Value = "40120002"
Else:
ThisWorkbook.Sheets("FRA&FFC").Cells(i, 18).Value = "40120001"
End If
If Trim(ThisWorkbook.Sheets("FRA&FFC").Cells(i, 6).Text) = "Z003" Then
ThisWorkbook.Sheets("FRA&FFC").Cells(i, 18).Value = "40120007"
End If
End If
Next i
'MsgBox "Done"
End Sub
I'm getting an error "Next without For".
Can any body help me with regards with this error. Why I am getting this?