View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tanyhart[_40_] tanyhart[_40_] is offline
external usenet poster
 
Posts: 1
Default Macro no longer working - Don Guillett


Don Guillett originally helped with the following macro to insert lines
It worked perfectly...until today. I went in to the spreadsheet an
tried to use it and I got a runtime error '13' on the line beginnin
mynum=

I have attached the code that is giving the error, and another on
which is identical. The second one works without any problem. Wh
would the first one not work anymore, when it once had?


Code
-------------------

Sub addtasks()
Application.DisplayAlerts = False
myrow = Cells.Find("Total P&C Estimate").Row - 3
mycell = Cells(myrow, 2)
mynum = Right(mycell, Len(mycell) - InStr(mycell, "#")) + 1

With Range(Cells(myrow, 2), Cells(myrow + 2, 2))
.EntireRow.Copy
.EntireRow.insert Shift:=xlDown
End With

Application.CutCopyMode = False
Cells(myrow + 3, 2) = "Task#" & mynum
Application.DisplayAlerts = True

End Sub

-------------------



Code
-------------------

Sub addtask()
Application.DisplayAlerts = False
myrow = Cells.Find("Total Central Maintenance Shops Estimate").Row - 12
mycell = Cells(myrow, 2)
mynum = Right(mycell, Len(mycell) - InStr(mycell, "#")) + 1

With Range(Cells(myrow, 2), Cells(myrow + 11, 2))
.EntireRow.Copy
.EntireRow.insert Shift:=xlDown
End With

Application.CutCopyMode = False
Cells(myrow + 12, 2) = "Task#" & mynum
Application.DisplayAlerts = True

End Sub

-------------------

--
tanyhar
-----------------------------------------------------------------------
tanyhart's Profile: http://www.excelforum.com/member.php...fo&userid=3514
View this thread: http://www.excelforum.com/showthread.php?threadid=57082