11@e
08-15-2019, 02:45 PM
I want to copy the rows that contain the word "Other" in column A from sheet D and paste them into sheet SORT - it is not giving an error and not doing anything. What am I doing wrong?
Sub Command()
a = Worksheets("D").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Worksheets("D").Cells(i, 1).Value = "Other" Then
Worksheets("D").Rows(i).Copy
Worksheets("SORT").Rows(i).Activate
b = Worksheets("SORT").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("SORT").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("D").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("D").Cells(1, 1).Select
End Sub
Sub Command()
a = Worksheets("D").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Worksheets("D").Cells(i, 1).Value = "Other" Then
Worksheets("D").Rows(i).Copy
Worksheets("SORT").Rows(i).Activate
b = Worksheets("SORT").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("SORT").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("D").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("D").Cells(1, 1).Select
End Sub