PC Review


Reply
Thread Tools Rate Thread

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

 
 
Vinita
Guest
Posts: n/a
 
      13th Mar 2008
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
 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      13th Mar 2008
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



--

Regards,
Nigel
(E-Mail Removed)



"Vinita" <(E-Mail Removed)> wrote in message
news:FD590980-BD4C-444F-BC22-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Vinita
Guest
Posts: n/a
 
      13th Mar 2008
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.

"Nigel" wrote:

> 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
>
>
>
> --
>
> Regards,
> Nigel
> (E-Mail Removed)
>
>
>
> "Vinita" <(E-Mail Removed)> wrote in message
> news:FD590980-BD4C-444F-BC22-(E-Mail Removed)...
> > 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

>

 
Reply With Quote
 
Andy Pope
Guest
Posts: n/a
 
      13th Mar 2008
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

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Vinita" <(E-Mail Removed)> wrote in message
news:FD590980-BD4C-444F-BC22-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Vinita
Guest
Posts: n/a
 
      13th Mar 2008

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
"Andy Pope" wrote:

> 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
>
> --
>
> Andy Pope, Microsoft MVP - Excel
> http://www.andypope.info
> "Vinita" <(E-Mail Removed)> wrote in message
> news:FD590980-BD4C-444F-BC22-(E-Mail Removed)...
> > 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

>

 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      14th Mar 2008
Format? Your OP did not mention this. Please explain more fully what you
are trying to do

--

Regards,
Nigel
(E-Mail Removed)



"Vinita" <(E-Mail Removed)> wrote in message
newsA30552C-1F21-41E3-9A39-(E-Mail Removed)...
> 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.
>
> "Nigel" wrote:
>
>> 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
>>
>>
>>
>> --
>>
>> Regards,
>> Nigel
>> (E-Mail Removed)
>>
>>
>>
>> "Vinita" <(E-Mail Removed)> wrote in message
>> news:FD590980-BD4C-444F-BC22-(E-Mail Removed)...
>> > 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

>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
using % button gives error "percent style not found" Can I reset? =?Utf-8?B?TGlnaHQ=?= Microsoft Excel Misc 3 16th Mar 2006 12:18 PM
how do i create a "clear" or "reset" button in a form??? =?Utf-8?B?TXVk?= Microsoft Access Forms 2 14th Feb 2005 11:41 PM
pressing the "reset" button and freeing memory Elie W Microsoft Excel Programming 3 12th Feb 2004 07:44 PM
Re: resource kit: gpresult mentioned "Security Configuration Editior" Mark Mancini Microsoft Windows 2000 Terminal Server Applications 2 11th Jul 2003 11:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:15 AM.