Free Advanced VBA exercises

This page lists 33 Advanced VBA exercises. You can use the menu to show just exercises for a specific topic.

Software: Advanced VBA
Version: Any MS Office versions
Topic: Class modules
Level: Relatively easy
Course: Advanced VBA
Exercise: Create a class to allow users to run a mortgage model (properties are things like house price and deposit).

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Revision of VBA
Level: Relatively easy
Course: Advanced VBA
Exercise: Loop over film cells, picking out those films having lots of reviews and colouring them.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Passing arguments
Level: Relatively easy
Course: Advanced VBA
Exercise: Create a routine to send an Outlook message. The argument list should vary according to whether you are copying the message to anyone.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: FileDialogs
Level: Relatively easy
Course: Advanced VBA
Exercise: Using FileDialogs to create customised file dialog boxes.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Revision of VBA
Level: Relatively easy
Course: Advanced VBA
Exercise: Write a macro to loop over a number of holidays, getting the details for each and writing these out to the immediate window.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: FileSystemObjects
Level: Relatively easy
Course: Advanced VBA
Exercise: Write a macro which creates a FileSystemObject reference, then uses this to list out all of the Excel workbooks in a folder.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Links to other applications
Level: Relatively easy
Course: Advanced VBA
Exercise: Create a PowerPoint macro writing slide information for an existing presentation to a new workbook in Excel.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Working with text files
Level: Relatively easy
Course: Advanced VBA
Exercise: Write a macro to loop over the lines in a text file, reading each in and storing the message.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Passing arguments
Level: Relatively easy
Course: Advanced VBA
Exercise: Create a couple of simple macros taking arguments - one to display a message, and one to protect or unprotect a worksheet.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Working with shapes
Level: Relatively easy
Course: Advanced VBA
Exercise: Write a macro to put block arrow shapes into different cells.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Links to other applications
Level: Relatively easy
Course: Advanced VBA
Exercise: Loop over cells in Excel, copying contents to Word bookmarks to write a letter.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Revision of VBA
Level: Average difficulty
Course: Advanced VBA
Exercise: An exercise to loop over all of the controls on a form, counting how many there are of each type.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Linking to data
Level: Average difficulty
Course: Advanced VBA
Exercise: Use ADO in VBA to add data to an Access database from an Excel workbook.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Class modules
Level: Average difficulty
Course: Advanced VBA
Exercise: An exercise to create a game class, such that when you set the home/away team name and score, an Add method adds the result to a table.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: FileSystemObjects
Level: Average difficulty
Course: Advanced VBA
Exercise: Write a macro to open lots of workbooks in turn, collating the responses from each.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Working with shapes
Level: Average difficulty
Course: Advanced VBA
Exercise: Write a macro to generate all of the autoshapes in a worksheet.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Class modules
Level: Average difficulty
Course: Advanced VBA
Exercise: Create a class to allow you to create simple pie charts. The chart has 3 simple properties - title, data range and slice to explode - and one method, print preview.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: FileDialogs
Level: Average difficulty
Course: Advanced VBA
Exercise: Creating a dialog box allowing multiple selection of files.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Revision of VBA
Level: Average difficulty
Course: Advanced VBA
Exercise: An exercise to loop over collections of characters in a Word paragraph.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Linking to data
Level: Average difficulty
Course: Advanced VBA
Exercise: Use ADO to extract a table of data from an Access database into a new Excel worksheet.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Passing arguments
Level: Average difficulty
Course: Advanced VBA
Exercise: Create a function to calculate Olympic medal points - this should take 3 arguments and return a single points total.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Links to other applications
Level: Average difficulty
Course: Advanced VBA
Exercise: Looping over words in a document, writing each to Excel and counting instances.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Linking to data
Level: Average difficulty
Course: Advanced VBA
Exercise: Create an input form for Beatles, linking Excel to Access using ADO, then read Beatles back into an array using REDIM PRESERVE.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Passing arguments
Level: Average difficulty
Course: Advanced VBA
Exercise: An exercise to add records to a database, using an optional argument for the postcode and also showing enumerations.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Revision of VBA
Level: Average difficulty
Course: Advanced VBA
Exercise: List out the number of shapes on each slide in a presentation, by looping over the slides.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: FileSystemObjects
Level: Average difficulty
Course: Advanced VBA
Exercise: Using FileSystemObjects to move, copy, rename and delete files and folders.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Working with text files
Level: Average difficulty
Course: Advanced VBA
Exercise: Read in a text file which contains the specification of a house, and colour Excel cells accordingly to draw it.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Passing arguments
Level: Average difficulty
Course: Advanced VBA
Exercise: Writing a program to calculate the factorial of a number without loopin, using recursive programming.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Advanced class modules topics
Level: Harder than average
Course: Advanced VBA
Exercise: An exercise to create a Holiday class and a strongly-typed Holidays collection, and test that these work.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: FileSystemObjects
Level: Harder than average
Course: Advanced VBA
Exercise: Consolidate data from files on your computer using file references.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Links to other applications
Level: Harder than average
Course: Advanced VBA
Exercise: A form with a combo box getting its values from an Access query.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Passing arguments
Level: Harder than average
Course: Advanced VBA
Exercise: Write a macro to work out Yahoo-style breadcrumbs given a table of regions. Each region record contains the region id and name and the id of the parent region.

Go to exercise ...

Software: Advanced VBA
Version: Any MS Office versions
Topic: Working with shapes
Level: Harder than average
Course: Advanced VBA
Exercise: Draw car shapes using a macro, and use them to simulate a race.

Go to exercise ...

You can search our full list of VBA exercises here.

This page has 0 threads Add post