I am working on a loop to look through the export file sheet column AF, which is column 32; if a cell in column 32 equals #N/A, then copy the value in column AE, which is column 31, and paste in sheet ‘errors and resolutions’ column A last row. My loop breaks at the next loop on the bold line.
<code>'Loop through column AF
For i = 2 To last row
'Activate worksheet
Worksheets("Exported File").Activate
'If condition is met then copy value from column AE
**If ws.Cells(i, 32).Value = CVErr(xlErrNA) Then ws.Cells(i, 31).Copy Else 'do nothing**
'
'Activate Errors & Resolutions sheet
Worksheets("Errors & Resolutions").Activate
'Find next empty cell
Range("A1").End(xlDown).Offset(1).Select
'Paste values123 (Actual values)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
</code>
<code>'Loop through column AF
For i = 2 To last row
'Activate worksheet
Worksheets("Exported File").Activate
'If condition is met then copy value from column AE
**If ws.Cells(i, 32).Value = CVErr(xlErrNA) Then ws.Cells(i, 31).Copy Else 'do nothing**
'
'Activate Errors & Resolutions sheet
Worksheets("Errors & Resolutions").Activate
'Find next empty cell
Range("A1").End(xlDown).Offset(1).Select
'Paste values123 (Actual values)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
</code>
'Loop through column AF
For i = 2 To last row
'Activate worksheet
Worksheets("Exported File").Activate
'If condition is met then copy value from column AE
**If ws.Cells(i, 32).Value = CVErr(xlErrNA) Then ws.Cells(i, 31).Copy Else 'do nothing**
'
'Activate Errors & Resolutions sheet
Worksheets("Errors & Resolutions").Activate
'Find next empty cell
Range("A1").End(xlDown).Offset(1).Select
'Paste values123 (Actual values)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
‘
End If
‘
Next i