Error Control no work :(

  • Thread starter Thread starter CodeSponge
  • Start date Start date
C

CodeSponge

I started a new message because the google server won't let me post to
my other msg. this is going to be one of those days.

Tom,

I checked and its set to unhandled errors.
I'm getting confused because I havn't changed my enviroment.
All I've done lately is debug a mod on an unrelated project.
I guess there are other errors in the exicution too.
A usr reported that a split screen routine doesn't split the screen
correctly anymore.
Instead of splitting the data from the header on row one it splits it
to a row between 5000 & 6000 randomly. this is odd because its
spicificly split to row one.

I'm getting a head ache.
 
I wonder how did your code worked earlier.
Your code will work if there was only 1 error during
the For .. Next loop. In susequent errors error handler
is disabled and it will give the exact error you are getting.

Try modifying your code as under.

On Error Resume Next
For Each ticket In Range( ... ).Rows
With ticket
.columns(NATL).Value = CDbl(.columns(NATL).Value)
.columns(CNUM).Value = CDbl(.columns(CNUM).Value)
If Err <> 0 Then
.Delete
Err.Clear
End If
End With
Next
On Error GoTo 0

Sharad
 
That is a good observation. Since he said it worked in the past, I guess he
never had more than one row to delete.
 
Yes. I too guess so.
If I were a baiting man I would bait it $10 ;-)
Sharad
 
That's a much cleaner way to write that.
It didn't occur to me to structure it that way.
Thanks

When I implemented that everything worked great again


But it wasn't the err.clear statement that was the problem I don't
think
I had that statement in the original code I just made an oops and
deleted it when I was cleaning it up for the post
I'm not going to worry about it anymore now though as long as it
works.
Thinks for the help guys! Really appreciate it. :)

This was the actual


' On Error GoTo ErrorNAN
' For Each ticket In Range(Range(Cells(CASES, LAST), Cells(CASES,
LAST).End(xlDown)), Range(Cells(CASES, HEADER), Cells(CASES,
HEADER).End(xlToRight))).Rows
' With ticket
' .columns(NATL).Value = CDbl(.columns(NATL).Value)
' .columns(CNUM).Value = CDbl(.columns(CNUM).Value)
' .columns(LTIM).Value = "=SUM(IF(RC[" & ZONE - LTIM &
"]=""AST"",TIME(2,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""EST"",TIME(1,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""MST"",-TIME(1,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""PST"",-TIME(2,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""AKST"",-TIME(3,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""HST"",-TIME(4,0,0),0),NOW())"
' ActiveSheet.Hyperlinks.Add Anchor:=.columns(CNUM),
address:="http://ps.sei-it.net/psc/ps/EMPLOYE...CASE_SW&Action=U&BUSINESS_UNIT=MCDON&CASE_ID="
& .columns(CNUM).Value
' End With
' If False Then
'ErrorNAN:
' ticket.Delete
' separations(1, LABL) = "Cashless"
' separations(1, GPID) = Array("MEGAPATH", "WAYPORT", "HUGHES")
' separations(1, SUMM) = Array("cashless", "connectivity", "wayport")
' separations(2, LABL) = "IST"
' separations(2, GPID) = Array("IST")
' err.clear
' End If
' Next
' On Error GoTo 0

This is the rework:

' On Error resume next
' For Each ticket In Range(Range(Cells(CASES, LAST), Cells(CASES,
LAST).End(xlDown)), Range(Cells(CASES, HEADER), Cells(CASES,
HEADER).End(xlToRight))).Rows
' With ticket
' .columns(NATL).Value = CDbl(.columns(NATL).Value)
' .columns(CNUM).Value = CDbl(.columns(CNUM).Value)
' .columns(LTIM).Value = "=SUM(IF(RC[" & ZONE - LTIM &
"]=""AST"",TIME(2,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""EST"",TIME(1,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""MST"",-TIME(1,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""PST"",-TIME(2,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""AKST"",-TIME(3,0,0),0),IF(RC[" & ZONE - LTIM &
"]=""HST"",-TIME(4,0,0),0),NOW())"
' ActiveSheet.Hyperlinks.Add Anchor:=.columns(CNUM),
address:="http://ps.sei-it.net/psc/ps/EMPLOYE...CASE_SW&Action=U&BUSINESS_UNIT=MCDON&CASE_ID="
& .columns(CNUM).Value
'
' If Err <> 0 Then
' .Delete
' Err.Clear
' ticket.Delete
' separations(1, LABL) = "Cashless"
' separations(1, GPID) = Array("MEGAPATH", "WAYPORT", "HUGHES")
' separations(1, SUMM) = Array("cashless", "connectivity",
"wayport")
' separations(2, LABL) = "IST"
' separations(2, GPID) = Array("IST")
' End If
' End With
' Next
' On Error GoTo 0
 

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

Back
Top