How do I invoke the "Reset" button in the VB Editior via code?

V

Vinita

Hi,
I am writing a macro in an MPP.The macro runs fine for the first
time.But
the next time its run its popping up an Error.But again after clicking
the
"Reset" button in the VB Editor the code works fine again.

Is there any way that I can "Reset" in the code itself?So that it will
work
fine the next time its run.


In Debug mode, Im getting "Run time Error 1004 Method Cells of object
'_Global' failed at the following line of code.
Cells.Find(what:=subtask_name, lookat:=xlWhole,
searchDirection:=xlNext).Activate



Thanks in advance,
Vinita
 
N

Nigel

It appears the search is failing. Try putting in line before the search
command e.g.

On Error Resume Next
Cells.Find(what:=subtask_name, lookat:=xlWhole,
searchDirection:=xlNext).Activate
 
V

Vinita

ok....This would continue with the next statements of my code even after the
error occurs.But, it would not give me the required format of the excel I
need.
 
A

Andy Pope

Hi,

Assign the result of the Find to an object and remove the Activate method.
If the item is not found the Activate will cause an error.

The help file has example code, select Find and press F1.

Cheers
Andy
 
V

Vinita

Actually in my program I am porting MPP data into an excel in a format.
And I checked the execution line by line and I find that the excel is
created and also the data it is searching is present in the excel.But Im not
able to figure out why then it is failing while search.

Thanks,
Vinita
 
N

Nigel

Format? Your OP did not mention this. Please explain more fully what you
are trying to do

--

Regards,
Nigel
(e-mail address removed)
 

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

Top