Hi All,
I'm trying to write a macro to insert new rows once the final row has been reached. I've named that cell "FinalLine" and have compiled the relevant bit of code below. The code works if the Active cell is the last "FinalLine" cell, but breaks when the active cell is not "FinalLine". Can anyone point me in the right direction? Ideally, if the cell is not "FinalLine", I would like the code to do nothing and continue with the rest of the code.
If ActiveCell.Name.Name = "FinalLine" Then
Thanks in advanced!
I'm trying to write a macro to insert new rows once the final row has been reached. I've named that cell "FinalLine" and have compiled the relevant bit of code below. The code works if the Active cell is the last "FinalLine" cell, but breaks when the active cell is not "FinalLine". Can anyone point me in the right direction? Ideally, if the cell is not "FinalLine", I would like the code to do nothing and continue with the rest of the code.
If ActiveCell.Name.Name = "FinalLine" Then
Selection.End(xlUp).Select
ActiveCell.EntireRow.Select
Selection.Resize(2).Select
Selection.Copy
Selection.Insert Shift:=xlDown
ActiveCell.PasteSpecial xlPasteValues
ActiveCell.EntireRow.Select
Selection.Resize(2).Select
Selection.Copy
Selection.Insert Shift:=xlDown
ActiveCell.PasteSpecial xlPasteValues
Else
ActiveCell.Select
End If
Thanks in advanced!