Split lines

chriscoogan

New Member
Joined
Jul 24, 2019
Messages
2
Hi All,

Is anyone able to help me with an odd excel question.

I need to split rows into new rows with qty 1.
Eg
Columns Stock Code, QTY, BIN
Row AB 10 AA-AA-AA

I need them to come out as:
AB 1 AA-AA-AA
AB 1 AA-AA-AA
AB 1 AA-AA-AA
AB 1 AA-AA-AA
AB 1 AA-AA-AA
AB 1 AA-AA-AA
AB 1 AA-AA-AA
AB 1 AA-AA-AA
AB 1 AA-AA-AA
AB 1 AA-AA-AA

Any thoughts in this?

Thanks
Chris
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi & welcome to MrExcel.
How about
Code:
Sub chriscoogan()
   Dim i As Long, Rws As Long
   
   For i = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
      Rws = Cells(i, 2).Value
      If Rws > 1 Then
         Rows(i + 1).Resize(Rws - 1).Insert
         Rows(i).Resize(Rws).FillDown
         Cells(i, 2).Resize(Rws).Value = 1
      End If
   Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,631
Messages
6,173,464
Members
452,516
Latest member
archcalx

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