Copy certain row to new sheet

miracleyy

New Member
Joined
Dec 17, 2013
Messages
26
Dear all,

i would like to copy each new order start from row "PH Order No:" to "0" to new sheet.
for below example, i would like to separate 4 order to 4 sheet.

Please help!!!


21kkobd.jpg
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
OK, the image in post#1 and the data you posted in Post #4 are different( no blanks in post #4)...which do you want to use ??
There is a difference in writing the code for each one...:confused:
 
Upvote 0
OK, the image in post#1 and the data you posted in Post #4 are different( no blanks in post #4)...which do you want to use ??
There is a difference in writing the code for each one...:confused:


It should be like below, and i would like to cut and copy the whole row not the cell only
Thanks again for you help!

qx6xow.jpg
 
Last edited:
Upvote 0
I can't access external images from where I am, hopefully someone else may be able to help.
The macro I provided previously should do the trick, but I don't understand this comment
Actually it success in sheet 5 and 6 but fail in sheet 2 3 4
if it copies data to one sheet, it should work for all
 
Upvote 0
I can't access external images from where I am, hopefully someone else may be able to help.
The macro I provided previously should do the trick, but I don't understand this comment

if it copies data to one sheet, it should work for all


It did copy data to sheet 5 and 6
but sheet 2 3 4 are blank
 
Upvote 0
miracleyy,

Your reply #13 contains a picture/graphic.

You are posting a picture. This means that if this was a problem where one needed to use your data, anyone trying to help you would have to enter the data manually. That makes no sense.


So that we can get it right this next time:

1. can we have another screenshot of the raw data in worksheet Sheet1?

2. can we have screenshots of at least two of the other resulting worksheets, say worksheets 1, and 2?


To post your data, you can download and install one of the following two programs:

Excel Jeanie
Download

MrExcel HTMLMaker20101230
https://onedrive.live.com/?cid=8cffdec0ce27e813&sc=documents&id=8CFFDEC0CE27E813!189

Installation instructions here:
http://www.mrexcel.com/forum/board-announcements/515787-forum-posting-guidelines.html#post2545970


If you are not able to give us screenshots:
You can upload your workbook to Box Net,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.
 
Upvote 0
miracleyy,

Sample raw data in worksheet Sheet1:


Excel 2007
ABCDEFGH
1Pick No:6767Order No:12Customer Name:abcStore Name:acb
2Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
3product code 1product name 11AmbientNormal8X1404-HLC4
4product code 2product name 22AmbientNormal30X1512-HLC58
5product code 3product name 33AmbientNormal24X1512-HLC52
6product code 4product name 44AmbientNormal24X15A01-02-0408
7product code 5product name 55AmbientNormal24X15A01-03-0702
8product code 6product name 66AmbientNormal12X105A02-05-02010
9product code 7product name 77AmbientNormal2X405A03-01-03120
10product code 8product name 88AmbientNormal12X15F02-01-0323
11product code 9product name 99AmbientNormal12X15F02-01-06250
120207
13Pick No:4545Order No:23Customer Name:abcStore Name:acb
14Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
15product code 1product name 11AmbientNormal8X1404-HLC4
16product code 2product name 22AmbientNormal30X1512-HLC58
17product code 3product name 33AmbientNormal24X1512-HLC52
180114
19Pick No:2442Order No:1123Customer Name:abcStore Name:acb
20Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
21product code 1product name 11AmbientNormal8X1404-HLC4
22product code 2product name 22AmbientNormal30X1512-HLC58
23product code 3product name 33AmbientNormal24X1512-HLC52
24product code 4product name 44AmbientNormal24X15A01-02-0408
25product code 5product name 55AmbientNormal24X15A01-03-0702
26product code 6product name 66AmbientNormal12X105A02-05-02010
270134
28Pick No:55555Order No:233Customer Name:abcStore Name:acb
29Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
30product code 1product name 11AmbientNormal8X1404-HLC4
31product code 2product name 22AmbientNormal30X1512-HLC58
32062
33
Sheet1


After the macro in worksheets 1, and, 9 (not all sheets are shown):


Excel 2007
ABCDEFGH
1Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
2product code 1product name 11AmbientNormal8X1404-HLC4
3product code 1product name 11AmbientNormal8X1404-HLC4
4product code 1product name 11AmbientNormal8X1404-HLC4
5product code 1product name 11AmbientNormal8X1404-HLC4
6
1



Excel 2007
ABCDEFGH
1Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
2product code 9product name 99AmbientNormal12X15F02-01-06250
3
9


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Code:
Sub DistributeRows()
' hiker95, 06/22/2014, ME785238
Dim w1 As Worksheet, ws As Worksheet, w As String
Dim Area As Range, r As Long, sr As Long, er As Long, nr As Long
Application.ScreenUpdating = False
Set w1 = Sheets("Sheet1")
For Each Area In w1.Range("B1", w1.Range("B" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants).Areas
  With Area
    sr = .Row
    er = sr + .Rows.Count - 1
    For r = sr + 2 To er Step 1
      w = w1.Cells(r, 3).Value
      If Not WorksheetExists(w) Then
        Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = w
      End If
      Set ws = Sheets(w)
      ws.Cells(1, 1).Resize(, 8).Value = Array("Product Code", "Picking Qty", "no.", "StorCond", "InvType", "StorCond", "Locaion", "Qty")
      nr = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1
      ws.Cells(nr, 1).Resize(, 8).Value = w1.Cells(r, 1).Resize(, 8).Value
      ws.Columns.AutoFit
    Next r
  End With
Next Area
w1.Activate
Application.ScreenUpdating = True
End Sub
Function WorksheetExists(w As String) As Boolean
On Error Resume Next
WorksheetExists = Worksheets(w).Name = w
On Error GoTo 0
End Function

Before you use the macro and function with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

Then run the DistributeRows macro.
 
Upvote 0
miracleyy,

Sample raw data in worksheet Sheet1:

Excel 2007
ABCDEFGH
1Pick No:6767Order No:12Customer Name:abcStore Name:acb
2Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
3product code 1product name 11AmbientNormal8X1404-HLC4
4product code 2product name 22AmbientNormal30X1512-HLC58
5product code 3product name 33AmbientNormal24X1512-HLC52
6product code 4product name 44AmbientNormal24X15A01-02-0408
7product code 5product name 55AmbientNormal24X15A01-03-0702
8product code 6product name 66AmbientNormal12X105A02-05-02010
9product code 7product name 77AmbientNormal2X405A03-01-03120
10product code 8product name 88AmbientNormal12X15F02-01-0323
11product code 9product name 99AmbientNormal12X15F02-01-06250
120207
13Pick No:4545Order No:23Customer Name:abcStore Name:acb
14Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
15product code 1product name 11AmbientNormal8X1404-HLC4
16product code 2product name 22AmbientNormal30X1512-HLC58
17product code 3product name 33AmbientNormal24X1512-HLC52
180114
19Pick No:2442Order No:1123Customer Name:abcStore Name:acb
20Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
21product code 1product name 11AmbientNormal8X1404-HLC4
22product code 2product name 22AmbientNormal30X1512-HLC58
23product code 3product name 33AmbientNormal24X1512-HLC52
24product code 4product name 44AmbientNormal24X15A01-02-0408
25product code 5product name 55AmbientNormal24X15A01-03-0702
26product code 6product name 66AmbientNormal12X105A02-05-02010
270134
28Pick No:55555Order No:233Customer Name:abcStore Name:acb
29Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
30product code 1product name 11AmbientNormal8X1404-HLC4
31product code 2product name 22AmbientNormal30X1512-HLC58
32062
33

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1



After the macro in worksheets 1, and, 9 (not all sheets are shown):

Excel 2007
ABCDEFGH
1Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
2product code 1product name 11AmbientNormal8X1404-HLC4
3product code 1product name 11AmbientNormal8X1404-HLC4
4product code 1product name 11AmbientNormal8X1404-HLC4
5product code 1product name 11AmbientNormal8X1404-HLC4
6

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
1



Excel 2007
ABCDEFGH
1Product CodePicking Qtyno.StorCondInvTypeStorCondLocaionQty
2product code 9product name 99AmbientNormal12X15F02-01-06250
3

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
9



Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Code:
Sub DistributeRows()
' hiker95, 06/22/2014, ME785238
Dim w1 As Worksheet, ws As Worksheet, w As String
Dim Area As Range, r As Long, sr As Long, er As Long, nr As Long
Application.ScreenUpdating = False
Set w1 = Sheets("Sheet1")
For Each Area In w1.Range("B1", w1.Range("B" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants).Areas
  With Area
    sr = .Row
    er = sr + .Rows.Count - 1
    For r = sr + 2 To er Step 1
      w = w1.Cells(r, 3).Value
      If Not WorksheetExists(w) Then
        Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = w
      End If
      Set ws = Sheets(w)
      ws.Cells(1, 1).Resize(, 8).Value = Array("Product Code", "Picking Qty", "no.", "StorCond", "InvType", "StorCond", "Locaion", "Qty")
      nr = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1
      ws.Cells(nr, 1).Resize(, 8).Value = w1.Cells(r, 1).Resize(, 8).Value
      ws.Columns.AutoFit
    Next r
  End With
Next Area
w1.Activate
Application.ScreenUpdating = True
End Sub
Function WorksheetExists(w As String) As Boolean
On Error Resume Next
WorksheetExists = Worksheets(w).Name = w
On Error GoTo 0
End Function

Before you use the macro and function with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

Then run the DistributeRows macro.


Thank you!!!!
But wt i want is to distribute by the order not the product code.
Is there any ways to do it??
Thanks again for your help ><
 
Upvote 0
miracleyy,

QUOTES
1. Quote ONLY if it is needed to add clarity or context for your reply. If so, then
2. Quote ONLY the specific part of the post that is relevant - - not the entire post.

This will keep thread clutter to a minimum and make the discussion easier to follow.


It is always best to display your actual raw data worksheet(s), and, the results that you are looking for. This way we can usually find a solution on the first go.

So that I can get it right this next time, I will have to see your actual workbook.

In your workbook I will need to see:
1. the raw data in its actual worksheet name
2. at least two of the resulting worksheets, with their actual worksheet names, and, manually formatted by you for the results you are looking for.


You can upload your workbook to Box Net,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.


If you are not able to provide the above, then:

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,461
Members
449,085
Latest member
ExcelError

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