Formula help...to insert rows

Nhunter

New Member
Joined
Mar 24, 2009
Messages
17
I am hoping to be able to insert a number of rows via formula. I am having issues coming up with anything on my own. I am hoping to duplicate(and insert) a specific row (x) number of times based on a number returned from a previous formula.

Any help would be greatly appriciated.

Best regards,
Nhunter
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Here are the first lines of what I am working with...not sure if there is an issue there I am not seeing.

Excel Workbook
ABCDEFGHIJKLMN
1Internal IDNameDisplay NameStore DescriptionDescriptionTypeBase PriceDisplay in Web SiteCategoryInactiveManufacturerStore Description2
227801422V420Motor Drive BeltThis is a replacement motor drive belt, part# 1422V420.Motor Drive Belt #1422V420Inventory Item34.95YesProducts and Services > Motor Drive BeltsNoThis is a replacement motor drive belt, part# 1422V420.
338940PETL515050 : Proform 595v : Drv MtrPROFORM 595V TREADMILL Drive MotorPETL515050Proform 595v Treadmill Drive Motor:235170Inventory Item319.99YesProducts and Services > Drive Motors > Proform Treadmill MotorsNoPROFORMThis Is The Replacement Drive Motor For The Proform 595v Treadmill.For Model Numbers: PETL515050
490440PROFORM XP 580 X-TRAINER:189462PROFORM XP 580 X-TRAINER Drive Belt246450PROFORM XP 580 X-TRAINER Motor Drive Belt:189462Inventory Item29.99YesProducts and Services > Motor Drive Belts > PROFORM Motor Drive BeltsNoPROFORMThis the replacement motor drive belt for the PROFORM XP 580 X-TRAINER. For Model Numbers: 246450
590450PROFORM XP 580S X-TRAINER:189462PROFORM XP 580S X-TRAINER Drive Belt246550PROFORM XP 580S X-TRAINER Motor Drive Belt:189462Inventory Item29.99YesProducts and Services > Motor Drive Belts > PROFORM Motor Drive BeltsNoPROFORMThis the replacement motor drive belt for the PROFORM XP 580S X-TRAINER. For Model Numbers: 246550
690491PROFORM 770EKG TREADMILL:186689PROFORM 770EKG TREADMILL Drive BeltPCTL99010 : PCTL99011PROFORM 770EKG TREADMILL Motor Drive Belt:186689Inventory Item39.99YesProducts and Services > Motor Drive Belts > PROFORM Motor Drive BeltsNoPROFORMThis the replacement motor drive belt for the PROFORM 770EKG TREADMILL. For Model Numbers: PCTL99010 : PCTL99011
790582PROFORM 520X TREADMILL:186689PROFORM 520X TREADMILL Drive BeltDRTL59220 : DRTL59221 : DRTL59222PROFORM 520X TREADMILL Motor Drive Belt:186689Inventory Item39.99YesProducts and Services > Motor Drive Belts > PROFORM Motor Drive BeltsNoPROFORMThis the replacement motor drive belt for the PROFORM 520X TREADMILL. For Model Numbers: DRTL59220 : DRTL59221 : DRTL59222
890840PROFORM 495PI TREADMILL:224019PROFORM 495PI TREADMILL Drive BeltPCTL952350PROFORM 495PI TREADMILL Motor Drive Belt:224019Inventory Item29.99YesProducts and Services > Motor Drive Belts > PROFORM Motor Drive BeltsNoPROFORMThis the replacement motor drive belt for the PROFORM 495PI TREADMILL. For Model Numbers: PCTL952350
CustomItemSearchResults463(1)
 
Upvote 0
This will skip rows containing 0 in column C

Code:
Sub InsRows()
Dim LR As Long, i As Long, j As Integer, X
LR = Range("C" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
    With Range("C" & i)
        If .Value <> 0 And .Value <> "" Then
            .Offset(1).Resize(.Value).EntireRow.Insert
            .EntireRow.Copy Destination:=.Offset(1, -2).Resize(.Value)
            X = Split(.Offset(, 3), ":")
            .Offset(, 1).Value = Trim(X(0)) & ": " & .Offset(, 1).Value
            For j = 1 To UBound(X)
                .Offset(j, 1).Value = Trim(X(j)) & ": " & .Offset(j, 1).Value
            Next j
        End If
    End With
Next i
Columns("D").AutoFit
End Sub
 
Upvote 0
Try

Code:
Sub InsRows()
Dim LR As Long, i As Long, j As Integer, X
LR = Range("C" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
    With Range("C" & i)
        If .Value <> 0 And .Value <> "" Then
            .Offset(1).Resize(.Value).EntireRow.Insert
            .EntireRow.Copy Destination:=.Offset(1, -2).Resize(.Value)
        End If
        X = Split(.Offset(, 3), ":")
        .Offset(, 1).Value = Trim(X(0)) & ": " & .Offset(, 1).Value
        For j = 1 To UBound(X)
            .Offset(j, 1).Value = Trim(X(j)) & ": " & .Offset(j, 1).Value
        Next j
    End With
Next i
Columns("D").AutoFit
End Sub
 
Upvote 0
You are the greatest! Thanks for the help. I know I was not the clearest communicator with regard to my issue!

Best regards,
Norman
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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