Excel to create new rows of data in a table

MRASHLEY

New Member
Joined
Sep 27, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello, I'm trying to achieve something in excel 365 which im not sure is possible

i have a simple table containing some products ie.

CODEITEM NAMEQUANTITY REQUIREDBOX QUANTITYNUMBER OF BOXES
0001RED TOP10101
0002BLUE TOP20102
0052YELLOW TOP20102
0063RED SHORTS15151
0064BLUE SHORTS30152
0048YELLOW SHORTS45153

What i want to do is create a new line in the table for each box that is needed for the order ie

CODEITEM NAMEQUANTITY REQUIREDBOX QUANTITYNUMBER OF BOXESCARTON NUMBER
0001RED TOP101011
0002BLUE TOP201022
0002BLUE TOP201023
0052YELLOW TOP201024
0052YELLOW TOP201025
0063RED SHORTS151516
0064BLUE SHORTS301527
0064BLUE SHORTS301528
0048YELLOW SHORTS451539

The yellow shorts would have 3 lines (carton number 10 & 11)

is there any way this can be done
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try:
VBA Code:
Sub InsertRows()
    Application.ScreenUpdating = False
    Dim x As Long, lRow As Long
    lRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For x = lRow To 2 Step -1
        If Range("E" & x) > 1 Then
            Rows(x).Copy
            Rows(x + 1).Resize(Range("E" & x) - 1).Insert
        End If
    Next x
    Range("F1") = "CARTON NUMBER"
    With Range("F2")
        .Value = "1"
        .AutoFill Destination:=Range("F2").Resize(Range("E" & Rows.Count).End(xlUp).Row - 1), Type:=xlFillSeries
    End With
    Columns.AutoFit
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,101
Messages
6,170,116
Members
452,302
Latest member
TaMere

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