sort and copy

jmd868s

New Member
Joined
Aug 25, 2011
Messages
7
I am trying to use VBA to sort a list that will be autogenerated and copy to various worksheets in the workbook based on the results. I have a workbook that lists a set of issues that have occured in a certain job and my boss wants this to be sorted per job. Here is what I have worked up so far and my problim is that 31241101 only occurs once but the find will pick it up multiple times, I need something to tell it to only search through once not to keep going through the entire list and finding the same stuff. As you can probably tell I am pretty new to VBA, here is a copy of what I have so far:

Sub sortandopy()

'search for "312411"
Worksheets("sheet1").Select
Cells.Find(What:="31241101", After:=Range("A1"), SearchDirection:=xlPrevious).Select
ActiveCell.EntireRow.Copy
Worksheets("312411").Select
ActiveSheet.Range("B1").Select
ActiveCell.Offset(1, -1).Range("A1").Select
ActiveSheet.Paste
Worksheets("sheet1").Select
Cells.Find(What:="31241101", After:=Range("A1"), SearchDirection:=xlPrevious).Select
ActiveCell.EntireRow.Copy
Worksheets("312411").Select
ActiveSheet.Range("B1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, -1).Range("A1").Select
ActiveSheet.Paste
Worksheets("sheet1").Select

End Sub

Any help would be appreciated
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,224,584
Messages
6,179,691
Members
452,938
Latest member
babeneker

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