CMF
Member
Microsoft Excel I have come to recognize as being the most popular program used by those who like to toss the numbers around in Lotto. Personally, I don't use it much as I favor Visual Basic these days but I still use my old Access 2000, especially when I'm just playing around with something, in which case I am most likely to use the debug window.
What some of you may not realize is that Excel uses VBA or Visual Basic for Applications just like Access. Quite often I have seen tedious use of the grid to do something that could be much more elegantly and simply presented using Visual Basic and the debug window.
Here's a simple step by step to get you started. In Excel from the Menu click Tools|Macro|Security. Change your security level to Medium - this means if you create a macro or procedure for a worksheet when opening it you will be presented with a dialog asking whether you wish to enable macros to which you select "yes".
To show the main editor from the Menu select Tools|Macro|Visual Basic Editor
or Macro for a list and then Step In. To show the debug window shorten your main editor to make some room then from the VBE menu View|Immediate Window.
You can create procedures and run them by simply clicking somewhere in the procedure and then run. You can output to the debug window by simply typing in your procedure debug.print "As an example " & myVariable. From the debug window you can call your own or built-in functions or procedures.
Some simple examples - type as shown in the debug window then press return:
?1+1
?13983816/2
? 13983816 Mod 1000
By making this post the opportunity is there for experienced programmers, who use VBA but not the Excel grid, to post some code and if they think it necessary make a reference to this thread for some background how to.
Regards
Colin Fairbrother

What some of you may not realize is that Excel uses VBA or Visual Basic for Applications just like Access. Quite often I have seen tedious use of the grid to do something that could be much more elegantly and simply presented using Visual Basic and the debug window.
Here's a simple step by step to get you started. In Excel from the Menu click Tools|Macro|Security. Change your security level to Medium - this means if you create a macro or procedure for a worksheet when opening it you will be presented with a dialog asking whether you wish to enable macros to which you select "yes".
To show the main editor from the Menu select Tools|Macro|Visual Basic Editor
or Macro for a list and then Step In. To show the debug window shorten your main editor to make some room then from the VBE menu View|Immediate Window.
You can create procedures and run them by simply clicking somewhere in the procedure and then run. You can output to the debug window by simply typing in your procedure debug.print "As an example " & myVariable. From the debug window you can call your own or built-in functions or procedures.
Some simple examples - type as shown in the debug window then press return:
?1+1
?13983816/2
? 13983816 Mod 1000
By making this post the opportunity is there for experienced programmers, who use VBA but not the Excel grid, to post some code and if they think it necessary make a reference to this thread for some background how to.
Regards
Colin Fairbrother
