
Visual Basic for Applications (“VBA”) is an implementation of Microsoft’s event-driven programming language Visual Basic 6.0 built into most desktop Microsoft Office applications.
1. Automating office tasks
Word, Excel, Access and PowerPoint are powerful applications each in their own right. Anyone who has used Word’s Mail Merge knows the joy of the many ways in which the applications are interoperable.
The next step is to use Macros to automate tasks and from there, it is not much of a stretch to start writing your own custom VBA code (even if it is with the help of a little Googling).
2. Learning to code
Fiddling around by recording Macros in Excel, Word and Access and then inspecting the generated code was my introduction to coding many years ago.
3. Tutorials
3.1 Common programming concepts
- If… Then… Else… syntax
- Declaring & using a variable
- Declaring and using Constants
- Checking Data types and Casting variables coming soon…
- Create a function
3.2 By application
I have also divided the VBA tutorials by application.
Excel
Word
Access
-
“Hello World!” with Excel VBA
This post provides a simple “Hello World” tutorial for Excel VBA beginners, covering Developer toolbar activation, writing basic code, testing a pop-up message, and saving…
-
Clearing ALL checkboxes in an Excel workbook
Yet another “helper” script for marking CAT PAT‘s! I was modifying one of the Excel marking rubrics and to test that I had linked up…
-
VBA for Excel: a little logic
This tutorial advances from a simple “Hello World” Excel VBA code to introducing branching If/Else logic for user interaction, with suggested improvements for handling user…
-
VBA to protect & unprotect Excel worksheets
This is part of a larger Excel VBA project that I am working on. The sheet is protected, but I need it to be unprotected…
-
Password-protecting your VBA Project
This post is a follow-up on how to protect Excel worksheets, providing guidance on securing a VBA Project. It details steps to lock the project…
-
Excel VBA Copy Each Sheet to a Workbook
I use digital mark sheets to mark ICT Practical Assessments; each student is marked on an individual worksheet in a workbook. I need to be able…
-
VBA to duplicate worksheets in Excel
This is part of a larger Excel VBA project I am working on. I want to duplicate worksheets based on a list of names in a…
-
Checking for blank cells in Excel with VBA
An easy-to-follow tutorial describing how to write VBA in Excel to find blank cells.
-
Excel VBA to select a cell based on its value
I use a workbook to keep a digital register for each of my classes. There is a column per day, so the spreadsheets become quite…
-
Create a custom function in Excel
Excel has hundreds of powerful functions. Here is how you can create your own! In this tutorial: Required knowledge: 1. Create As a simple example,…
-
VBA to list files in directory
Listing files in a directory is a common programming task. This tutorial walks you through how this can be achieved in VBA and how the…
-
VBA to check if a file name exists
his tutorial will cover creating code to check if a specific file name exists. If you enter just a file name, it will check the…
-
Writing data to a file with VBA
In the More Windows batch files tutorial we learnt to pipe output to a text file using a batch file. We will now learn how…
-
VBA looping through Text Boxes in Word
The tutorial explains how to find and replace text in textboxes via Excel VBA, providing code to loop through textboxes and use InputBoxes to replace…
-
Loop through all open Word docs with VBA
This VBA code snippet loops through all open Word documents, displaying the Document names one by one in a popup. This code could be implemented…
-
VBA to manipulate Track Changes settings in Word
This tutorial explains how to use VBA for looping through all open Word documents and enabling Track Changes in each document, with suggested references for…
-
Display the full pathname of a Word document in the Title Bar
I have multiple Microsoft Word documents open simultaneously while marking CAT practical assessment papers. As I have the student’s file, the original file, as well…
-
VBA to truncate or delete Access database tables
Access SQL does not have anything like TRUNCATE table. There is also no way to run a DROP table query. In this tutorial: Required knowledge: 1. What you…