Macro - Working except it's skipping Line 3

rroth2004

New Member
Joined
Sep 23, 2013
Messages
8
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
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Instead of looping through column E, why not just filter the column on "SMITH" and cut/paste the visible range?
 
Upvote 0
Instead of looping through column E, why not just filter the column on "SMITH" and cut/paste the visible range?
I'm actually looping thru multiple names. Just posted the one "Smith" as an example. The full code is the above - times maybe 13 or 14 sheets/different names.
Probably not the cleanest way of doing it but I'm still learning.
 
Upvote 0
Rather the asking for help using only one name, it is better to describe in full what you want to do so that you end up with a final solution. It would be easier to help if you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0
Solution

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top