Actuarial Outpost

Actuarial Outpost (http://www.actuarialoutpost.com/actuarial_discussion_forum/index.php)
-   Software & Technology (http://www.actuarialoutpost.com/actuarial_discussion_forum/forumdisplay.php?f=17)
-   -   Best way to learn VBA. (http://www.actuarialoutpost.com/actuarial_discussion_forum/showthread.php?t=88423)

Childish Gambino 06-10-2015 12:08 PM

don't you hate it when you need to use a macro that you wrote before but you can't find that macro?

i have no clue where or why i would have done this but i know i did dammit

campbell 06-10-2015 01:57 PM

Quote:

Originally Posted by Childish Gambino (Post 8097872)
don't you hate it when you need to use a macro that you wrote before but you can't find that macro?

i have no clue where or why i would have done this but i know i did dammit

Sometimes I email the code from macros to myself

and then search in my email

[i find it a lot easier to search gmail than search my files]

JMO 06-10-2015 07:43 PM

Quote:

Originally Posted by campbell (Post 8098127)
Sometimes I email the code from macros to myself

and then search in my email

[i find it a lot easier to search gmail than search my files]

Or you could create a "Macro Watch" thread on the AO. :D

campbell 06-10-2015 09:31 PM

no.

Actinium ad Infinitum 06-22-2015 03:05 PM

To really learn any language, you need to spend a ton of hours developing code. But, the best way to get started is to check out some free online tutorials.

Actinium ad Infinitum 06-22-2015 03:13 PM

Include the following on the first line of your VBA code module:

Option Explicit

This will save you lots of trouble and headaches.

Fracktuary 06-22-2015 03:57 PM

Quote:

Originally Posted by Actinium ad Infinitum (Post 8115477)
Include the following on the first line of your VBA code module:

Option Explicit

This will save you lots of trouble and headaches.

Get Visual Studio if you dont need the excel functionality.

Actinium ad Infinitum 06-28-2015 02:54 AM

SQL in vba
 
Try to get most calculations out of Excel as Excel is slow. If dealing with many rows or lots of data, do the heavy lifting in a data base via SQL strings and odbc connections. Can typically access the MS Access DB engine (i.e., jet). I use Excel as a user platform to access and create databases in my vba applications.

actuary21c 07-26-2015 11:26 PM

Set "Require Variable Declaration" to ticked in Tools, Options in VBA window
 
Quote:

Originally Posted by Actinium ad Infinitum (Post 8115477)
Include the following on the first line of your VBA code module:

Option Explicit

This will save you lots of trouble and headaches.

Better (because it saves you having to remember to type Option Explicit at the top of each of your code modules):

In the VBA window, from the menu, Tools, Options, on the Editor tab, make sure that "Require Variable Declaration" is ticked. (It should be ticked by default, but it isn't - a bug in Excel VBA in my view).
If you have that ticked, the Option Explicit line will be added automatically to any *new* modules or class modules you create (but NOT for any of existing modules you created before the change to the Options - unless Microsoft have improved things recently, you'll have to go back and add the line manually to those).

campbell 07-27-2015 05:52 AM

Quote:

Originally Posted by actuary21c (Post 8162988)
Better (because it saves you having to remember to type Option Explicit at the top of each of your code modules):

In the VBA window, from the menu, Tools, Options, on the Editor tab, make sure that "Require Variable Declaration" is ticked. (It should be ticked by default, but it isn't - a bug in Excel VBA in my view).
If you have that ticked, the Option Explicit line will be added automatically to any *new* modules or class modules you create (but NOT for any of existing modules you created before the change to the Options - unless Microsoft have improved things recently, you'll have to go back and add the line manually to those).

I require my students to do that when we start the VBA section.


All times are GMT -4. The time now is 04:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

Page generated in 0.10557 seconds with 9 queries