Hello, right now, I have a macro that works great where I can insert x number of rows at the bottom of a range. The first line in the range is a row of formulas and this row gets copied into all the rows that are added. What I'm looking to do is be able to add these x rows above the selected/active cell instead of at the end. I cannot figure it out for the life of me.
Existing macro:
Sub Add_Budget_Item_02()
Call Begin
Set Irs = wsInputs.Range("Budget_Item_02")
Set Ire = wsInputs.Range("Budget_Item_03")
Set Brs = wsBudget.Range("Budget_02")
Set Bre = wsBudget.Range("Budget_03")
'Determine how many lines to add to the category
NumItems = Application.InputBox( _
Prompt:="How many items would you like to enter?", _
Title:="Enter Line Items", _
Type:=1)
If NumItems = False Then Exit Sub
'Add line item to input tab budget item
Ire.Offset(-1, 0).Resize(NumItems, 1).EntireRow.Insert
Irs.Offset(1, 0).EntireRow.Copy Destination:=Ire.Offset(-NumItems - 1, 0).Resize(NumItems, 1).EntireRow
Ire.Offset(-NumItems - 1, 0).Resize(NumItems, 1).EntireRow.Hidden = False
'Add line item to budget tab budget item
Bre.Offset(-1, 0).Resize(NumItems, 1).EntireRow.Insert
Brs.Offset(1, 0).EntireRow.Copy Destination:=Bre.Offset(-NumItems - 1, 0).Resize(NumItems, 1).EntireRow
Bre.Offset(-NumItems - 1, 0).Resize(NumItems, 1).EntireRow.Hidden = False
Ire.Offset(-2, 2).Select
Call Done
End Sub
Existing macro:
Sub Add_Budget_Item_02()
Call Begin
Set Irs = wsInputs.Range("Budget_Item_02")
Set Ire = wsInputs.Range("Budget_Item_03")
Set Brs = wsBudget.Range("Budget_02")
Set Bre = wsBudget.Range("Budget_03")
'Determine how many lines to add to the category
NumItems = Application.InputBox( _
Prompt:="How many items would you like to enter?", _
Title:="Enter Line Items", _
Type:=1)
If NumItems = False Then Exit Sub
'Add line item to input tab budget item
Ire.Offset(-1, 0).Resize(NumItems, 1).EntireRow.Insert
Irs.Offset(1, 0).EntireRow.Copy Destination:=Ire.Offset(-NumItems - 1, 0).Resize(NumItems, 1).EntireRow
Ire.Offset(-NumItems - 1, 0).Resize(NumItems, 1).EntireRow.Hidden = False
'Add line item to budget tab budget item
Bre.Offset(-1, 0).Resize(NumItems, 1).EntireRow.Insert
Brs.Offset(1, 0).EntireRow.Copy Destination:=Bre.Offset(-NumItems - 1, 0).Resize(NumItems, 1).EntireRow
Bre.Offset(-NumItems - 1, 0).Resize(NumItems, 1).EntireRow.Hidden = False
Ire.Offset(-2, 2).Select
Call Done
End Sub