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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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,214,793
Messages
6,121,617
Members
449,039
Latest member
Mbone Mathonsi

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