MACRO NEEDED

PM1

Board Regular
Joined
Oct 28, 2005
Messages
192
Purch Orders BP²I.xls
ABCDEFGHIJK
1PS PO NoLine NoCompanyPart NoDetailsQtyUnit Cost (GBP)Expense / AssetAsset ValueGLCodeGL Description
241Repton292889-421ProLiant DL360 (G3) R02 Xeon DP 2.8GHz, 512MB61,266.0091,266241370Windows NT Servers
381Repton325134-421ProLiant DL580 (G2) R02 Xeon16,365.0096,365241370Windows NT Servers
Steve


Is there a way to run a Macro that goes to "F6", then If the No. > 1 copies the row and inserts it by the No. in "F6" - 1, therefore in this instance 5 rows identical 2 Row 2 would be copied, and so on till the end of the column.

So the sheet would look like:
Purch Orders BP²I.xls
ABCDEFGHIJK
1PS PO NoLine NoCompanyPart NoDetailsQtyUnit Cost (GBP)Expense / AssetAsset ValueGLCodeGL Description
241Repton292889-421ProLiant DL360 (G3) R02 Xeon DP 2.8GHz, 512MB61,266.0091,266241370Windows NT Servers
341Repton292889-421ProLiant DL360 (G3) R02 Xeon DP 2.8GHz, 512MB61,266.0091,266241370Windows NT Servers
441Repton292889-421ProLiant DL360 (G3) R02 Xeon DP 2.8GHz, 512MB61,266.0091,266241370Windows NT Servers
541Repton292889-421ProLiant DL360 (G3) R02 Xeon DP 2.8GHz, 512MB61,266.0091,266241370Windows NT Servers
641Repton292889-421ProLiant DL360 (G3) R02 Xeon DP 2.8GHz, 512MB61,266.0091,266241370Windows NT Servers
741Repton292889-421ProLiant DL360 (G3) R02 Xeon DP 2.8GHz, 512MB61,266.0091,266241370Windows NT Servers
881Repton325134-421ProLiant DL580 (G2) R02 Xeon16,365.0096,365241370Windows NT Servers
996NetAppsFAS960C-IB-BASE2 FAS960, CFO, IB, DATA ONTAP138,960.64938,961241400Networks
10131Repton7038-6M2Rack Server 1:pSeries 650 Model 6M2 CEC42,753.2592,753653120BIBM Servers
Steve
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try this code:

Sub Macro1()
Dim Nrow, Qty
Nrow = 1
Do
Nrow = Nrow + 1
Qty = Cells(Nrow, 6).Value
If Qty > 1 Then
Rows(Nrow + 1 & ":" & Nrow + Qty - 1).Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Range(Cells(Nrow, 1), Cells(Nrow, 11)).Copy
Range(Cells(Nrow + 1, 1), Cells(Nrow + Qty - 1, 1)).PasteSpecial
Nrow = Nrow + Qty - 1
End If
Loop Until Qty = ""
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,730
Members
448,987
Latest member
marion_davis

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