Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fatal Error message when running macro

Status
Not open for further replies.

GoatieEddie

Technical User
Nov 3, 2003
177
CA
Hi Guys,

Bit of a disaster here! I have been running a macro which worked fine. Now however, when I run it, halfway through I get an Excel Message box saying the following: THE INSTRUCITON AT "0x6503627f" REFERENCED MEMORY AT "0x00000000". THE MEMORY COULD NOT BE "READ". CLICK OK TO TERMINATE THIS APPLICATION.

What may have caused this to start happening as I haven't changed any code over the past 24hrs!? I have rebooted and all that jazz but still no joy.

HELP!!

GE
 
Can you see what line it bombs on ?? If not, what happens when you "step thru" the sub using F8 ??

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
The problem is it is rather complex and falls over on the x iteration where x seems to be a bit random.
 
Sounds like a memory overflow to me.
Try making your code leaner and meaner.. ;-)
Or check for an infinite loop

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Can you post the line it bombs on (does it always bomb on the same line ??) and comment on what the values of any variables are and where they have come from...

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Hi Geoff,

It is difficult to see where it actually bombs because the msg box is modal and immediately shuts down Excel and VB when you click on OK. :( I am puzzled because it was working last week! If it is a memory isue as makeItSo suggests I guess it may work on a different machine? I'll try that but still happy to receive your infinite wisdoms!

Cheers,
GE
 
try stepping thru the code with F8 - should make it quite obvious where it's bombing

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
As I mentioned before, it bombs after a random number of iterations after an extended period (effectively the lengthy main procedure which calls several sub-procedures is wrapped by a for each loop) and so it isn't possible to F8 it meaningfully. Would using a conditional break at the last know good cell (in the for each Loop)and then F8 make sense?
 
I'd recommend binary search:
Put a break point at where you guess the code could crash.
If it does not crash until there, the error must be in the code below the break point.
Put the break point at half of the code below and re-try.

This way you should be able to really pin-point it down.
;-)

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top