Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Two problems with Application.Run "ATPVBAEN.XLA!Random"

This is in Excel 2002 - with Visual Basic 6.3.

I have two problems with a macro than uses this function. Neither are
killers, but both are annoying. I have seen similar problems
referenced in this group over the years, but never really saw an
answer (usually somebody had a different way of achieving the desired
outcome rather than a straight fix).

The first problem I have a workaround for but would really appreciate
some explanation as to what is going on.

Basically I have a macro to allow a "Monte Carlo" type simulation, but
also allow the same set of random numbers to be recreated for test
etc. The key line is:
Application.Run "ATPVBAEN.XLA!Random",
ActiveSheet.Range("RandomBlock"), 3, 41, 1, intSeed, 0, 1

(intSeed is a number that changes in a regular way through the
iterations.)

I can get this to run. But if i break the macro early (mainly due to
the second problem) and then try to run it again, i get the error:
The macro '' cannot be found.

This error also happens at other times for no reason I can understand
(for example, I recorded the macro to get the structure of the
equation and it worked fine either running with a macro button or
straight from the code - but then I changed the seed value from '1' to
'intSeed' and it began giving the error noted, so I changed it back to
'1' but the error kept happening until I tried the thing below).

The workaround is to now uncheck the add-in for "Analysis Tool-Pak
VBA" (and excel then says it can't to that because it is in use, but
seems to anyway) and then recheck it again. The macro now runs fine -
until I do something random and it all falls apart again.

The obvious question is "why?".

The second problem is that I don't really want to see all the
iterations happening (just the averaged results of the x simulations I
run). So I have an Application.ScreenUpdating = False line in the
macro. But the screen still updates every time that the
Application.Run line is hit. Is there any way to stop this happening?

Thanks in advance.

James

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Two problems with Application.Run "ATPVBAEN.XLA!Random"

This helps with Solver:

Run "atpvbaen.xla!auto_open"

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


wrote in message
ups.com...
This is in Excel 2002 - with Visual Basic 6.3.

I have two problems with a macro than uses this function. Neither are
killers, but both are annoying. I have seen similar problems
referenced in this group over the years, but never really saw an
answer (usually somebody had a different way of achieving the desired
outcome rather than a straight fix).

The first problem I have a workaround for but would really appreciate
some explanation as to what is going on.

Basically I have a macro to allow a "Monte Carlo" type simulation, but
also allow the same set of random numbers to be recreated for test
etc. The key line is:
Application.Run "ATPVBAEN.XLA!Random",
ActiveSheet.Range("RandomBlock"), 3, 41, 1, intSeed, 0, 1

(intSeed is a number that changes in a regular way through the
iterations.)

I can get this to run. But if i break the macro early (mainly due to
the second problem) and then try to run it again, i get the error:
The macro '' cannot be found.

This error also happens at other times for no reason I can understand
(for example, I recorded the macro to get the structure of the
equation and it worked fine either running with a macro button or
straight from the code - but then I changed the seed value from '1' to
'intSeed' and it began giving the error noted, so I changed it back to
'1' but the error kept happening until I tried the thing below).

The workaround is to now uncheck the add-in for "Analysis Tool-Pak
VBA" (and excel then says it can't to that because it is in use, but
seems to anyway) and then recheck it again. The macro now runs fine -
until I do something random and it all falls apart again.

The obvious question is "why?".

The second problem is that I don't really want to see all the
iterations happening (just the averaged results of the x simulations I
run). So I have an Application.ScreenUpdating = False line in the
macro. But the screen still updates every time that the
Application.Run line is hit. Is there any way to stop this happening?

Thanks in advance.

James



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Two problems with Application.Run "ATPVBAEN.XLA!Random"

On Jun 18, 10:56 pm, "Jon Peltier"
wrote:
This helps with Solver:

Run "atpvbaen.xla!auto_open"

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______




I put that in the macro and it did all sort of weird things (it
wouldn't 'clear' the results block anymore - just gave me an error
"Range method of _global failed" or something).

Thanks anyway.

James

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
"WinForm Application" to act as "RTD Server" using .Net mduraidi Excel Discussion (Misc queries) 0 March 30th 06 01:01 PM
"WinForm Application" to act as "RTD Server" using .Net mduraidi Excel Programming 0 March 30th 06 12:55 PM
"ATPVBAEN.XLA!Random... output M_Nadel Excel Programming 1 March 7th 05 10:51 PM


All times are GMT +1. The time now is 11:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"