[Solved] Insert here ... or not

BrianDP1977

Board Regular
Joined
Nov 5, 2005
Messages
146
I don't understand why this won't work. This code is a slightly adjusted code offered by HalfAce in a different post:

Code:
Sub Insert_Row(nRange As Range) 
Dim InsrtRw As Long

InsrtRw = Range(nRange).Cells(Rows.Count, 1).End(xlUp).Row 
Range(nRange).Rows(InsrtRw).EntireRow.Copy 
Range(nRange).Rows(InsrtRw).EntireRow.Insert 
Application.CutCopyMode = False 
End Sub

What I'm trying to do is create an Insert_Row code that will be passed a named range of cells (through the nRange variable). Within this selected range of cells, I want a whole row added to the last line within the specified range of cells. I need this added row to become part of the named range (expressing the range of cells as a dynamic name should accomlish this) and also maintain the equations contained in the cells (thus the reason for the copy call). Thanks for the help.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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