Copied around an existing Macro I found online. Where it searches the data on sheet 1 for a name in column E and then pastes it into the corresponding sheet in the workbook.
It works great and moves all the data over except it leaves Line 3 (A3) of the Data for some reason. If I run the macro a second time, it'll sort that last item just fine.
But wondering where in the code I'm skipping Line 3 in Sheet1?
Below is the truncated example of the code. I have the meat of the code duplicated multiple times based on Last Name and Sheet #.
Any help?
Sub Sort_Date()
Dim StatusCol As Range
Dim Status As Range
Dim PasteCell As Range
Set StatusCol = Sheet1.Range("E2:E300")
For Each Status In StatusCol
If Sheet2.Range("A2") = "" Then
Set PasteCell = Sheet2.Range("A2")
Else
Set PasteCell = Sheet2.Range("A1").End(xlDown).Offset(1, 0)
End If
If Status = "SMITH" Then Status.Offset(0, -4).Resize(1, 15).Cut PasteCell
Next Status
End Sub
It works great and moves all the data over except it leaves Line 3 (A3) of the Data for some reason. If I run the macro a second time, it'll sort that last item just fine.
But wondering where in the code I'm skipping Line 3 in Sheet1?
Below is the truncated example of the code. I have the meat of the code duplicated multiple times based on Last Name and Sheet #.
Any help?
Sub Sort_Date()
Dim StatusCol As Range
Dim Status As Range
Dim PasteCell As Range
Set StatusCol = Sheet1.Range("E2:E300")
For Each Status In StatusCol
If Sheet2.Range("A2") = "" Then
Set PasteCell = Sheet2.Range("A2")
Else
Set PasteCell = Sheet2.Range("A1").End(xlDown).Offset(1, 0)
End If
If Status = "SMITH" Then Status.Offset(0, -4).Resize(1, 15).Cut PasteCell
Next Status
End Sub