Master Microsoft VBA (Visual Basic for Applications) and automate your everyday tasks across Office applications like Excel, Access, and Word. Our expert-led training will teach you how to write code that saves you time, reduces errors, and customises your applications to meet your exact needs.
Our face-to-face and online VBA courses are available in London and UK-wide. With a proven track record of excellence, we have trained over 170,066 people in Microsoft applications since 2001.
Our team provides hands-on, context-rich practical work-shops. They draw upon their considerable real world experience to deliver learning that is valuable and relevant with immediate impact/ROI.
Citigroup
Vice President
D.P.
Top-quality training by friendly instructors in good venues
"I've done several courses with these guys, including Advanced Excel and PowerPoint. The days are well organised and they lay on a great lunch, too. Their tutors are always lively and engaged with attendees. I thoroughly recommend their services."
Below are some extracts from our VBA manuals.
Procedure is a term that refers to a unit of code created to perform a specific task. In Excel, procedures are stored in objects called Modules. In this unit we will look at both Modules and Procedures.
Standard modules can be used to store procedures that are available to all forms, worksheets and other modules. These procedures are usually generic and can be called by another procedure while the workbook is open.
Within a project you can create as many standard modules as required. You should store related procedures together within the same module.
Standard modules are also used to declare global variables and constants. To create a standard module in the VB Editor:
A procedure is a named set of instructions that does something within the application.
To execute the code in a procedure you refer to it by name from within another procedure. This is known as Calling a procedure. When a procedure has finished executing it returns control to the procedure from which it was called.
There are two general types of procedures:
If you require 10 stages to solve a problem write 10 sub procedures. It is easier to find errors in smaller procedures than in a large one.
The procedures can then be called, in order, from another procedure.
There are rules and conventions that must be followed when naming procedures in Visual Basic.
While rules must be followed or an error will result, conventions are there as a guideline to make your code easier to follow and understand.
The following rules must be adhered to when naming procedures:
You should consider these naming conventions when naming procedures:
Following these conventions, here is an example of procedure names:
Most Excel tasks can be automated by creating procedures. This can be done by either recording a macro or entering the code directly into the VB Editor’s Code window.
Sub procedures have the following syntax:
[Public/Private] Sub ProcedureName ([argument list])
Statement block
End Sub
Public indicates procedure can be called from within other modules. It is the default setting.
Private indicates the procedure is only available to other procedures in the same module.
The Sub... End Sub structure can be typed directly into the code window or inserted using the Add Procedure dialogue box.
To create a sub procedure:
OR
To display the Add Procedure dialogue box:
The Add Procedure dialogue box appears:
Function procedures are similar to built-in functions such as Sum(). They are sometimes called user-defined function.
A function returns a value to the procedure that calls it. The value the function generates is assigned to the name of the function.
Function procedures have the following syntax:
[Public/Private] Function FunctionName ([argument list]) [As
[Statement block]
[FunctionName =
End Function
Public indicates procedure can be called from within other modules. It is the default setting
Private indicates the procedure is only available to other procedures in the same module.
The As clause sets the data type of the function’s return value.To create a function procedure:
Display the Add Procedure dialog box (as in Creating a Sub Procedure):
The Add Procedure dialog box appears (as seen in Creating a Sub Procedure):
A sub procedure or function is called from the point in another procedure where you want the code to execute. The procedure being called must be accessible to the calling procedure. This means it must be in the same module or be declared public.
When passing multiple arguments (as in the function procedure above) always separate them with commas and pass them in the same order as they are listed in the syntax.
Auto Quick Info is a feature of the Visual Basic that displays a syntax box when you type a procedure or function name.
Arguments in square brackets are optional.
Values passed to procedures are sometimes referred to as parameters.
The Immediate window is a debugging feature of Visual Basic. It can be used to enter commands and evaluate expressions.
Code stored in a sub or function procedure can be executed by calling the procedure from the Immediate window.
To open the Immediate window:
OR
The Immediate window appears.
To execute a sub procedure:
To execute a function and print the return value in the window:
To evaluate an expression:
Within the code, especially in loops, use the Debug.Print statement to display values in the Immediate window while the code is executing. The Immediate window must be open for this.
The Code editor window is used to edit Visual Basic code. The two drop down lists can be used to display different procedures within a standard module or objects’ event procedures within a class module.
The settings for the Code Editor can be changed. To do this:
The Options dialog box appears.
The following are explanations of the Code Setting selections:
The Windows Settings selections are explained below:
Below are some useful guidelines to follow when editing code, as taught in our VBA training courses London:
OR
It is also a good idea to comment your code to document what is happening in your project. Good practice is to comment what is not obvious.
Start the line with an apostrophe ( ‘ ) or by typing the key word Rem (for remark). When using an apostrophe to create a comment, you can place the comment at the end of a line containing a code statement without causing a syntax error.
VBA Courses in London are the most popular way to learn to use Visual Basic. Once you reach a sufficient level you can interact with other Office applications such as Access and Word. In addition, VBA can connect to other data sources such as a SQL or Oracle database. We offer VBA training in London and UK wide. Contact us for further information.
Our Visual Basic London Course is taught via our training centres in the city. Alternatively you can choose to have your training on-site and we will come to you. The Excel VBA course will significantly reduce the amount of errors made in a delegates day to day operations.
Our expert trainers teach VBA training courses for all versions of Microsoft Visual Basic. We have professional training centres in London and also provide on-site and near-site training throughout the UK.
NB. A lot of people find this page using the search phrases visual+basic+courses+uk and vb training course. If this is the case, we recommend that you visit our course overview page to figure out the most relevant training course for your needs.
Call for assistance
We will call you back