Insert Rows

MCC123

New Member
Joined
Apr 17, 2019
Messages
13
Hello all,
I created a workbook to keep track of maintenance records for some of our certifications and equipment. I am trying to insert a row below each header row for continuous data it works off of a command button and at the end of a year it will add a new row for each cert or piece of equipment copying the formulas and conditional formatting. I can provide the code upon request. below is an example of the format. Thanks for any help!

Example:

Equip 1
insert row
Equip 2
insert row
Equip 3
insert row
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I need to insert a row after b15, then b16, then b17 and it would need to be continuous after clicking the command button to start a new year.... it would insert a row between b15 and b16, b16 and b17, b17 and b18 and so on and then be able to insert a row after the last line of data for each piece of equipment. Can anyone steer me in the right direction? Thanks in advance.

Sub insertrowLIR()

Dim Ans
Ans = MsgBox("Are you sure you want to insert rows?", vbOKCancel)
If Ans = vbOK Then
Worksheets("Locomotive Insp. Report").Rows(16).Insert shift:=xlShiftDown
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(15).Copy
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(16).Select
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(16).PasteSpecial xlPasteFormats

Worksheets("Locomotive Insp. Report").Rows(18).Insert shift:=xlShiftDown
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(17).Copy
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(18).Select
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(18).PasteSpecial xlPasteFormats
Worksheets("Locomotive Insp. Report").Rows(20).Insert shift:=xlShiftDown
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(19).Copy
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(20).Select
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(20).PasteSpecial xlPasteFormats
Worksheets("Locomotive Insp. Report").Rows(22).Insert shift:=xlShiftDown
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(21).Copy
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(22).Select
ThisWorkbook.Sheets("Locomotive Insp. Report").Rows(22).PasteSpecial xlPasteFormats
Application.CutCopyMode = False
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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