Dynamic Macros #1

Hi everybody,

Today we’ll talk about dynamic macros very useful in engineering modeling, scientific modeling, games etc. Dynamic macros are created using two different type of loops: “For” and “Do”.
– Two different but equivalent conditional “Do” loops are explored.
– It is shown that macros can be assigned to drawing shapes, pictures, graph, etc.
– A highly valuable Run/Pause macro is described and implemented. The reader must pay close attention to this presentation. In order to create science, engineering models, or games in Excel one needs to know these techniques well.


This article has 10 Comments

  1. George,

    Thanks for sharing your great expertise.
    This is really great material for my simulation

  2. Thanks Vladan. 2007 is OK but somewhat slower. Cheers!

  3. Dear George,
    thanks for your reply. Your approach is amasing. It really helps one go further. You did a tremendeous work! I’ ll get excell 2007. Thank you!

  4. Vladan, the vast majority of the models here do work with the new versions of Excel if you set up the stilly security so the program can run macros. Not hard at all, just Google, how to enable macros in Excel 2013 (or whatever version you have). The only problem with the new excel version is the speed, which can be anywhere between 3 to 7 times slower (that’s most of the time a chart display problem and cannot be solved). Noroc, George.

  5. Dear George,
    It seems to be problematic to run the programs the way they functioned in the older versions of excel. Do you have any advice?

    Thank you

  6. Dear George,
    thanks a lot for this topic. Everything works fine. It’s a wonderful educational tool, I found a lot of new things here. Thanks for your great job !

  7. Vlad, the first 4 macros are designed to run up to 1000 and then stop by themselves. You can only stop them in the middle by holding Escape or from the VBA editor hit the square “Stop” button. The ONLY macro that can be paused and restart from the same button is the very last one. The first four loops are supposed to crash if you hit Loop while running.The way they are written there is no other way. The tutorial builds up knowledge of regular loop and at the end it shows you a really good one which you should always use if you want to save buttons.
    About the speed I cannot answer. Microsoft dropped the ball here. I personally stay away from those versions. Most of the performance drop might come from charting.
    Thanks for the notice. George

  8. Dear George, after testing of Dynamic Macros #1 in three versions of Excel (2003, 2007 and 2010) I found the following:
    1) The program accidentally shuts down when I occasionally click twice on Loop1 label. The same happened with the rest of labels – Loop 2/ Loop3/ Loop4 when I intentionally clicked on them several times.
    2) It’s impossible to stop any Loop correctly by clicking on Run/Stop label. It just does not stop, and when I try it again by clicking on Run/Stop – the program shuts down.
    3) Of course, this is not a news for you, comparing the speed of all three versions of Excel the 2003 is an incomparable champion..2007 and 2010 are real losers. The difference in speed is tremendous. Do you know why ?
    Thanks for your attention.

Leave a Reply

Your email address will not be published. Required fields are marked *