Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Craig Daniels   on Sep 21 In MS Office Category.

  
Question Answered By: Mason Evans   on Sep 21

When you say that you are stepping though the code  in isolation and stepping
through the code manually, what exactly do you mean? Are you talking about
setting a breakpoint and then stepping the code when the breakpoint triggers?
Or are you running  this code manually rather than triggering it in the normal
manner?

Seeing you are getting a range  error, you need to have a look at your Range
calls.

Range isn't a function - it's a method  of an appropriate object. Although it
will sometimes make assumptions over which object  it is to associate with, there
are times when it'll make the wrong  assumptions. You're talking about named
ranges here, so each Range call should be qualified to the owner of the named
range (either the application or a worksheet, from memory - check the "applies
to" in the help). This is especially important inside an event, where it may
not know what it should associate the Range method with.

Re modal ... I was actually thinking the reverse. I was wondering if your form
needed ProcessData to run  before the user  starts clicking on the form. In that
case, you either need to kill the modal, or better to put the required code into
the form's initialisation. If it should only run after the user closes the
form, then the form  should stay modal.

As for whether the form needs to be open ... it depends what your later code
does, but also depends on how you close the form. If you just hide it, then it
stays around and you can use its fields. If you unload it, then it's gone and
any further reference to it will either fail or will create a brand new instance
of it - neither being desirable.

However, explicitly qualify all your Range calls - I have a suspicion that this
is where you are having problems.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Problem with calling Sub from UserForm Or get search suggestion and latest updates.


Tagged: