VBA

This is a collection of short tutorials to get you started from the very beginning of creating your first VBA program. We cover each of the basic topics in enough detail with examples to quickly get you coding.

1 - Installing VBA and First Program - What do you need to start using visual basic application VBA.

2 - Comments in VBA code - As always it is important to add comments to your code otherwise it will could be hard work to maintain.

3 - Creating Variables - Variables are placeholders for data, this allows us to access these placeholders for a range of reasons in our programs.

4 - Datatypes in VBA. - This section covers a brief introduction to each of the main datatypes in VBA.

      4.1 - Boolean - These can be considered as "on" or "off" switches.

      4.2 - Numerical Datatypes - How to create numbers and how to use them.

      4.3 - Strings - How to create and use arrays of characters.

      4.4 - Arrays (List, 1d and 2d) - How to use arrays.

      4.5 - Dates and times - Introduction to date and times.

      4.6 - Currency - Brief introduction the currency datatype.

5 - If statements - Conditional flow - Conditional flow is key to creating powerful scripts and programs.

6 - Creating and using Functions in VBA - Recycling code saves writing the same code over and over.

7 - Datatype conversions - Example code showing how to convert between datatypes.

8 - Common builtin functions and Graphs in VBA - Some examples of interesting functions you need to know.

9 - Indentation blocks - Using white-space for readable VBA code - A guide to how to layout you program for readability. This is not required for your program to work - though you will appreciate it when you need to debug it.

10 - Loops - Loops are core to creating short powerful codes.

       10.1 - For loops in VBA - Loops that loops over a finite number of values.

       10.2 - While loops in  VBA - Loops that loop indefinitely until a criteria is met.

11 - Name Space in VBA - How you can access variables at different points in your code.

12 - Escape Characters - Adding returns and tabs to your strings.

13 - Object Orientated VBA - creating classes and using them.

14 - Using VBA to read and write to a text file - Exporting and import data to and from other files.

15 - Using date and time built in functions - Built-in in functions for date and time datatypes.

16 - GOTO statements in VBA - Jumping around your programs and scripts goto statements allow you change up your flow - though do note this is considered poor practice.

17 - How to handle errors in VBA (Error Handling) - A short example showing how to create error handling in your programs.

18 - VBA and Microsoft Excel - Reading and writing to cells and reading and writing to cells in a range of worksheets.

19 - VBA and Microsoft Word - Reading and Writing to paragraphs and tables in Microsoft word document using VBA.

20 - VBA, Access databases and SQL databases - Using Excel with databases - a basic example.

21 - Buttons in VBA - This is a short example showing how to add buttons to your script.

22 - Userforms in VBA - Creating professional user forms for inputting and displaying data in VBA excel.

23 - Application Object - Using the applications features in your code.

24 - Recording Macros - A great way to start using VBA to create macros.