excel - Error Resetting not working -


i writing macro renumber points , lines. in following code, err.number not resetting , code breaks @ 2nd instance of error. how fix this?

s = 0 ss = 0 surfaces = y      ss = ss + 1 handler:     s = s + 1      on error goto handler      set hybridbodyshape1 = hybridbodyshapes1.item("line_extract_" & s)     hybridbodyshape1.name = "line_extract_" & ss      set hybridbodyshape1 = hybridbodyshapes1.item("point_extract_" & s)     hybridbodyshape1.name = "point_extract_" & ss      on error goto 0 loop until s = surfaces - 1 

i don't know expect loop (or error "handler") do, should change implementation this:

on error resume next     if err.number = 0 ss = ss + 1     err.clear     s = s + 1      set hybridbodyshape1 = hybridbodyshapes1.item("line_extract_" & s)     hybridbodyshape1.name = "line_extract_" & ss      if err.number = 0         set hybridbodyshape1 = hybridbodyshapes1.item("point_extract_" & s)         hybridbodyshape1.name = "point_extract_" & ss     end if loop until s = surfaces - 1 on error goto 0 

the err object doesn't magically reset because jump label in case of error.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -