ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Fails to Run Correctly (https://www.excelbanter.com/excel-programming/307537-macro-fails-run-correctly.html)

JK

Macro Fails to Run Correctly
 
I have about seven procedures that are written to run in succession from a
worksheet CmdBtn. However, several do not unless I manually run them with
F5. It has worked for me in other applications, so I'm baffled. Plus, the MS
debugger identifies the problem with a Range.ClearContents function which is
the last procedure and yet several procedures before it have failed, so I'm
doubly baffled. And, as stated, they all run without a hitch when run
manually.

Any suggestions? Thank you.

Jim Kobzeff



Tom Ogilvy

Macro Fails to Run Correctly
 
The code you say doesn't run; is it conditional on if statements. If so,
possibly your conditions are not being met.

--
Regards,
Tom Ogilvy

"JK" wrote in message
...
I have about seven procedures that are written to run in succession from a
worksheet CmdBtn. However, several do not unless I manually run them with
F5. It has worked for me in other applications, so I'm baffled. Plus, the

MS
debugger identifies the problem with a Range.ClearContents function which

is
the last procedure and yet several procedures before it have failed, so

I'm
doubly baffled. And, as stated, they all run without a hitch when run
manually.

Any suggestions? Thank you.

Jim Kobzeff





Tushar Mehta

Macro Fails to Run Correctly
 
In addition to Tom's suggestion, do you have any 'On Error Resume
Next' or 'On Error goto {somewhere}' statements? If so, unless they
are protect against *expected* errors, lose them. You will find
debugging greatly simplified.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I have about seven procedures that are written to run in succession from a
worksheet CmdBtn. However, several do not unless I manually run them with
F5. It has worked for me in other applications, so I'm baffled. Plus, the MS
debugger identifies the problem with a Range.ClearContents function which is
the last procedure and yet several procedures before it have failed, so I'm
doubly baffled. And, as stated, they all run without a hitch when run
manually.

Any suggestions? Thank you.

Jim Kobzeff




JK

Macro Fails to Run Correctly
 
Thank you for the suggestions. Both did contribute in finding the problem.
Seems the sheet must be activated. Strange because it worked fine without
activation up until a week ago.

Thanks again

"JK" wrote in message
...
I have about seven procedures that are written to run in succession from a
worksheet CmdBtn. However, several do not unless I manually run them with
F5. It has worked for me in other applications, so I'm baffled. Plus, the

MS
debugger identifies the problem with a Range.ClearContents function which

is
the last procedure and yet several procedures before it have failed, so

I'm
doubly baffled. And, as stated, they all run without a hitch when run
manually.

Any suggestions? Thank you.

Jim Kobzeff






All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com