Try this:
Sub TryMod()
Dim WS1 As Worksheet, PasteSht As Worksheet
Dim PShtNRow As Long, WS1LRow As Long
With ThisWorkbook
Set WS1 = .Sheets("AAA")
Set PasteSht = .Sheets("PPP")
End With
With WS1
WS1LRow = .Cells(Rows.Count, "B").End(xlUp).Row
For Iter = WS1LRow to 1 Step -1
PShtNRow = PasteSht.Cells(PasteSht.Rows.Count, 1).End(xlUp).Row + 1
If .Cells(Iter, "F").Value = "SSSS" And .Cells(Iter, "U").Value <= 5 And .Cells(Iter, "U").Interior.ColorIndex = xlNone Then
.Rows(Iter).Copy PasteSht.Rows(PShtNRow)
End If
Next Iter
End With
Application.CutCopyMode = False
End Sub
The main issue is you have to qualify your properties and methods when you're using With
. You can't got With WS1
then use just Cells
. It has to be .Cells
. Otherwise, Excel won't know which sheet's Cells
you're referring to, among other possible errors that can happen.
Next is, with regards to For
loops and especially copying to the next empty row in another sheet, you have to remember to put the check for the next empty row inside the loop. If you set it at the beginning, it will only take in one value and overwrite the row that corresponds to that value again and again.
Now, the above is hacked together really quickly so kindly test it and let us know of the results. :)