What am I doing wrong in the third loop? I want to copy rows if the value is not equal to one of the conditions in my IF statement. I don't get any errors, so my logic/ approach is def wrong. The first 2 loops work just fine.
Code:
Sub copy_date()
Application.ScreenUpdating = False
Dim a As Long, b As Long, c As Long, d As Long, e As Long, f As Long
'copy vr3
a = Worksheets("export").Cells(rows.Count, 1).End(xlUp).Row
For i = 2 To a
If _
Worksheets("export").Cells(i, 6).Value = "U054185" Or _
Worksheets("export").Cells(i, 6).Value = "U054189" Or _
Worksheets("export").Cells(i, 6).Value = "U054190" Then
Worksheets("export").rows(i).Copy
Worksheets("vr3").Activate
b = Worksheets("vr3").Cells(rows.Count, 1).End(xlUp).Row
Worksheets("vr3").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("export").Activate
End If
Next
'copy vr2
c = Worksheets("export").Cells(rows.Count, 1).End(xlUp).Row
For i = 2 To c
If _
Worksheets("export").Cells(i, 6).Value = "U054181" Or _
Worksheets("export").Cells(i, 6).Value = "U054182" Or _
Worksheets("export").Cells(i, 6).Value = "U054183" Or _
Worksheets("export").Cells(i, 6).Value = "U054184" Or _
Worksheets("export").Cells(i, 6).Value = "U054186" Or _
Worksheets("export").Cells(i, 6).Value = "U054187" Or _
Worksheets("export").Cells(i, 6).Value = "U054188" Or _
Worksheets("export").Cells(i, 6).Value = "U054191" Then
Worksheets("export").rows(i).Copy
Worksheets("vr2").Activate
d = Worksheets("vr2").Cells(rows.Count, 1).End(xlUp).Row
Worksheets("vr2").Cells(d + 1, 1).Select
ActiveSheet.Paste
Worksheets("export").Activate
End If
Next
'copy vr1
e = Worksheets("export").Cells(rows.Count, 1).End(xlUp).Row
For i = 2 To c
If _
Worksheets("export").Cells(i, 6).Value <> "U054181" Or _
Worksheets("export").Cells(i, 6).Value <> "U054182" Or _
Worksheets("export").Cells(i, 6).Value <> "U054183" Or _
Worksheets("export").Cells(i, 6).Value <> "U054184" Or _
Worksheets("export").Cells(i, 6).Value <> "U054185" Or _
Worksheets("export").Cells(i, 6).Value <> "U054186" Or _
Worksheets("export").Cells(i, 6).Value <> "U054187" Or _
Worksheets("export").Cells(i, 6).Value <> "U054188" Or _
Worksheets("export").Cells(i, 6).Value <> "U054189" Or _
Worksheets("export").Cells(i, 6).Value <> "U054190" Or _
Worksheets("export").Cells(i, 6).Value <> "U054191" Then
Worksheets("export").rows(i).Copy
Worksheets("vr1").Activate
f = Worksheets("vr2").Cells(rows.Count, 1).End(xlUp).Row
Worksheets("vr1").Cells(f + 1, 1).Select
ActiveSheet.Paste
Worksheets("export").Activate
End If
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub