Automatically duplicate and insert a row based on a cell value in that row.

AFnav04

New Member
Joined
Apr 18, 2019
Messages
1
I have a sheet that I am entering in values for to layout power requirements.
My table has a colum for Devce Name, PDU Location, Max Power (W), Max Current (A) [this is automatically calculated based on he power field divided by 120V], Breaker value [auomaticly looked up based on a defined list of values (5, 10, 20)]. If I enter a current that exceeds 20A I need to create a second line becuase this will require two breakers. I dont want to have to go through and manually add rows every time I run across this issue.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I will assume your headers start in column A and are contiguous, making the amperage column D. The code goes into your standard code module1.
Code:
Sub t()
Dim i As Long
    With ActiveSheet 'Be sure hou have the sheet you want the row added to is active
        For i = .Cells(Rows.Count, 4).End(xlUp).Row To 2 Step -1
            If .Cells(i, 4).Value > 20 Then
                .Rows(i).Copy 'assumes 2nd breaker will be the same.
                .Rows(i + 1).Insert
                Application.CutCopyMode = False
            End If
        Next
    End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
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