VB exiting silently and inexplicably

  • Thread starter Thread starter Iain King
  • Start date Start date
I

Iain King

My vb code is mysteriously aborting without any error or warning.
It's got me puzzled in the extreme. The following code copies values
from cells from one sheet into the columns of a row on a second sheet
(with debugging stuff added):

For Each n In ScanSetup.Names
If Left(n.Name, 4) = "EDIT" And n.Name <> "EDIT_ClientTitle"
Then
tail = Mid(n.Name, 6)
Debug.Print Sheets("Records").Cells(row, Range("RECORDS_"
+ tail).Column).Value
Debug.Print Sheets("Edit").Range(n.Name).Value
Stop
Sheets("Records").Cells(row, Range("RECORDS_" +
tail).Column).Value = _
Sheets("Edit").Range(n.Name).Value
Stop
End If
Next

It prints off the debugs fine, so the cell references are ok. It hits
the first stop, but then terminates. The value in the destination
cell is unchanged. Any ideas?

Iain
 
I'd double check the range names. Maybe they're not what you expect.

To make your checking easier, get Jan Karel Pieterse's (with Charles Williams
and Matthew Henson) Name Manager:

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp
 
I'd double check the range names. Maybe they're not what you expect.

To make your checking easier, get Jan Karel Pieterse's (with Charles Williams
and Matthew Henson) Name Manager:

You can find it at:
NameManager.Zip fromhttp://www.oaltd.co.uk/mvp

The names are accurate - otherwise the debug.prints wouldn't work.

Iain
 
Your Stop statement seems to be acting like an End statement--but that
should only happen if the code is in a compiled executable
(i.e., .exe) file. Is it in an .exe file?

Mark Lincoln
 
Your Stop statement seems to be acting like an End statement--but that
should only happen if the code is in a compiled executable
(i.e., .exe) file. Is it in an .exe file?

Mark Lincoln

The Stop statements are just for debugging. If I take them out the
code exits at teh same point. (Really, the stops are just break
points I can type into usenet so you can see where they are.) It's
the line between the Stops which is acting like an End statement - the
cell is not getting set.

Iain
 
Back
Top