Please help. I am trying to add a row to the last row in a named range, I have found the following code:
Sub newRow()
Dim target As Range
Dim cell As Range
Dim rowNr As Integer
Set target = Range("FDrivers")
If line <> -1 Then
rowNr = line
Else
rowNr = target.Rows.Count
End If
target.Rows(rowNr + 1).EntireRow.Offset(1, 0).Insert
target.Rows(rowNr).Copy target.Rows(rowNr + 1)
For Each cell In target.Rows(rowNr + 1).Cells
If Left(cell.Formula, 1) <> "=" Then cell.Clear
Next cell
End Sub
This does work but it adds the row to the first row in the range and not the last. How do I add to the last row in the range?
Sub newRow()
Dim target As Range
Dim cell As Range
Dim rowNr As Integer
Set target = Range("FDrivers")
If line <> -1 Then
rowNr = line
Else
rowNr = target.Rows.Count
End If
target.Rows(rowNr + 1).EntireRow.Offset(1, 0).Insert
target.Rows(rowNr).Copy target.Rows(rowNr + 1)
For Each cell In target.Rows(rowNr + 1).Cells
If Left(cell.Formula, 1) <> "=" Then cell.Clear
Next cell
End Sub
This does work but it adds the row to the first row in the range and not the last. How do I add to the last row in the range?