Old, working macro now stops partway (without error) after Selection.Insert

C

Charles Blaquière

(Excel 2000) I have a worksheet I've been using for 11 years, but a year or
two ago, one of my macros started misbehaving. I've managed manually since
then, but decided to revisit the problem.

The macro creates a copy of the last data row in my sheet, pastes it below,
then populates the cells with the defaults I need for a new data row.

The problem: the macro now exits after successfully pasting the copied row -
the . No error is displayed, but the following statements are not executed.
If I step through the macro in debug mode, once the Selection.Insert
statement is executed, the yellow "current statement" arrow disappears and
pressing F8 again starts execution at the top of the macro.

Do you have any idea why my previously-solid macro is behaving this way?
Here's the top part of the code.

Thanks,

Charles
__________

Sub New_row()
Dim CellAboveTotal As Range, MyRow As String
' Duplicate last row (above total)
Application.Goto reference:="First_blank_row"
Selection.Cells(1, 1).Activate
ActiveCell.Offset(-1, 0).Rows("1:1").EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown

' Leave these cells as duplicates of previous entry: Project, Stage,
Task
' Paste current date in Date cell, and current time in Start Time cell
Cells(ActiveCell.Row, DateColumn).Select
Call Paste_date(Date) ' Remember: moves one cell to the right
ActiveCell.Offset(0, 1).Select
Call Paste_time(Now) ' Remember: moves one cell to the right
' Clear End Time cell
ActiveCell.ClearContents
' Status should be "New"
Cells(ActiveCell.Row, StatusColumn).Value = "New"

[code continues...]
__________

In Debug, all values are defined, e.g. First_blank_row = 983:983, DateColumn
= 5, StatusColumn = 11. (Undefined values would generate errors, anyway, and
no errors appear.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top