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:
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.
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.