Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default error handling - dodgy syntax

Hi Helen,

Yeah the resume would resume at the line that created the error which
you have already cleared.

Change your error handling to:

ChangeNotNecessary:
If Err.Number = 1004 Then
Resume Nextx

else
Msgbox Err.number & " " & Err.Description
End If

Nextx:
Next x


Any problems then post back,

James

Helen wrote:
I've created the following code, but it will only run once before sticking,
I've included Resume, but I'm not sure I've put it in the right place. After
the error has been identified I want the macro to move on to Next X.

For x = 4 To myRows
NewFormat = Range("G" & x)

On Error GoTo ChangeNotNecessary

If WorksheetFunction.Search(",", NewFormat, 1) + 2 = Len(NewFormat) Then

Range("G" & x).Select

Selection.Replace What:=".", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:=",", Replacement:=".", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Style = "Comma"

End If

ChangeNotNecessary:
If Err.Number = 1004 Then
Err.Clear
End If
On Error GoTo 0
Resume

Next x


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
UDF Error Handling is ignored. Not for everyone? [email protected] Excel Programming 4 March 22nd 06 06:31 PM
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM
error handling jeffP Excel Programming 1 July 3rd 04 06:10 PM
Error Handling bw Excel Programming 3 June 20th 04 06:43 PM


All times are GMT +1. The time now is 10:24 AM.

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"