Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Macro no longer working - Don Guillett

Hi tanyhart,

myrow = Cells.Find("Total P&C Estimate").Row - 3


This line of code will fail if the text "Total P&C Estimate" is not found on
the active worksheet. What do you want to happen if that text is not found?
Or is it possible that the code is running when a different sheet is active?

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]

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

I have attached the code that is giving the error, and another one
which is identical. The second one works without any problem. Why
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

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macro no longer working - Don Guillett

sounds like the data you are processing is causing the error.

do you have any error values in that data?

--
Regards,
Tom Ogilvy


"tanyhart" wrote:


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

I have attached the code that is giving the error, and another one
which is identical. The second one works without any problem. Why
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

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


--
tanyhart
------------------------------------------------------------------------
tanyhart's Profile: http://www.excelforum.com/member.php...o&userid=35148
View this thread: http://www.excelforum.com/showthread...hreadid=570827


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Macro no longer working - Don Guillett

Sorry - misread your question and looked at the wrong line. Please
disregard.

Jake Marx wrote:
Hi tanyhart,

myrow = Cells.Find("Total P&C Estimate").Row - 3


This line of code will fail if the text "Total P&C Estimate" is not
found on the active worksheet. What do you want to happen if that
text is not found? Or is it possible that the code is running when a
different sheet is active?

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

I have attached the code that is giving the error, and another one
which is identical. The second one works without any problem. Why
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

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macro no longer working - Don Guillett

Just an added thought for the benefit of the OP.

that's true, but I wouldn't see that causing a type mismatch error (error
13) two lines later.

--
Regards,
Tom Ogilvy


"Jake Marx" wrote:

Hi tanyhart,

myrow = Cells.Find("Total P&C Estimate").Row - 3


This line of code will fail if the text "Total P&C Estimate" is not found on
the active worksheet. What do you want to happen if that text is not found?
Or is it possible that the code is running when a different sheet is active?

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]

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

I have attached the code that is giving the error, and another one
which is identical. The second one works without any problem. Why
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

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMIF no longer working David Schwartz Excel Discussion (Misc queries) 3 November 10th 09 01:13 AM
SUMIF no longer working Monish Excel Worksheet Functions 4 February 2nd 09 04:47 AM
hyperlinks no longer working Duncan Excel Discussion (Misc queries) 0 September 25th 06 04:50 PM
Formulas no longer working DK Excel Worksheet Functions 3 May 10th 06 05:07 PM
Help: Excel 4 macro suddenly no longer working Keske Saram Excel Programming 0 July 4th 05 02:15 AM


All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"