Free Excel VBA Macros exercises

This page lists 52 Excel VBA Macros exercises. You can use the menu to show just exercises for a specific topic.

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Debugging and error handling
Level: Relatively easy
Course: Excel VBA macros
Exercise: Use the On Error statement in a VBA procedure to prevent users entering an invalid date into an input box.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Relatively easy
Course: Excel VBA macros
Exercise: Write macros to select various ranges absolutely using a battleships game as template.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Relatively easy
Course: Excel VBA macros
Exercise: Write code to change the colour of cells and sink ships in a rudimentary version of Battleships.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Forms
Level: Relatively easy
Course: Excel VBA macros
Exercise: Create an Excel VBA user form to allow users to apply to a dating agency.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Relatively easy
Course: Excel VBA macros
Exercise: Write a subroutine to enter your details into an application form for a dating agency.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Relatively easy
Course: Excel VBA macros
Exercise: Write one or more simple macros to fill in capital cities on different worksheets (shows selecting worksheets and selecting cells).

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Relatively easy
Course: Excel VBA macros
Exercise: A macro to loop over shapes on a worksheet changing their line colour - lots of hints given.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Loops and conditions
Level: Relatively easy
Course: Excel VBA macros
Exercise: Write a macro to loop over cells following instructions until you reach the cottage of Red Riding Hood!.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Recording macros and buttons
Level: Relatively easy
Course: Excel VBA macros
Exercise: Using Microsoft Excel to record macros to take the strain out of repetitive tasks.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Relatively easy
Course: Excel VBA macros
Exercise: Select one cell in a battleships grid relative to another.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Relatively easy
Course: Excel VBA macros
Exercise: Write a simple macro to guide Red Riding Hood through a maze, using lots of OFFSET commands.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Forms
Level: Relatively easy
Course: Excel VBA macros
Exercise: Create a form to enter a film name and category, such that when you click on an ADD button the film is added to an Excel list.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Messages and variables
Level: Relatively easy
Course: Excel VBA macros
Exercise: Write a macro which asks for your name using INPUTBOX and then displays a welcome message using MSGBOX.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Visual Basic explained
Level: Relatively easy
Course: Excel VBA macros
Exercise: Spot why the pictures are not genuine Visual Basic collections.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Event handling
Level: Relatively easy
Course: Excel VBA macros
Exercise: Use the BeforeSave event to attach a macro to a workbook to keep a log of changes.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Average difficulty
Course: Excel VBA macros
Exercise: Use the End and Offset properties in Excel VBA to copy the details of dating-agency applicants to the end of a list.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Recording macros and buttons
Level: Average difficulty
Course: Excel VBA macros
Exercise: Using absolute recording mode to record macros to repeat actions on the same set of cells.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Average difficulty
Course: Excel VBA macros
Exercise: Write a macro to select the last task in a block of tasks.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Loops and conditions
Level: Average difficulty
Course: Excel VBA macros
Exercise: Write a macro to loop over a column of dinosaurs, colouring the ones meeting certain conditions.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Event handling
Level: Average difficulty
Course: Excel VBA macros
Exercise: Use worksheet events to create a basic game of Battleships.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Forms
Level: Average difficulty
Course: Excel VBA macros
Exercise: A form for entering details of dinosaurs, including a combobox, listbox, option buttons and spinner buttons.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Messages and variables
Level: Average difficulty
Course: Excel VBA macros
Exercise: Write a macro to input a dinosaur name using an INPUTBOX, find it on a spreadsheet and then display the height of the dinosaur using MSGBOX.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Average difficulty
Course: Excel VBA macros
Exercise: Loop over all of the cells in a block, creating a psychedelic pattern to resemble Elmer the elephant.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Messages and variables
Level: Average difficulty
Course: Excel VBA macros
Exercise: Use input boxes in Excel VBA to ask a user to enter details for a dating agency application.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Event handling
Level: Average difficulty
Course: Excel VBA macros
Exercise: Various macros to test your understanding of event-handling within Excel.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Loops and conditions
Level: Average difficulty
Course: Excel VBA macros
Exercise: Use a Do Until loop to extract invalid data from a list of dating-agency applications in Excel VBA.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Functions
Level: Average difficulty
Course: Excel VBA macros
Exercise: Create functions to turn feet/inches into kilograms, stones/pounds into metres and then calculate body mass index.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Average difficulty
Course: Excel VBA macros
Exercise: Write VBA code in Excel to loop over a collection of cells to pick a set of six random numbers to use in a lottery.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Average difficulty
Course: Excel VBA macros
Exercise: A macro to loop over the 100 x 100 grid that is Wimbledon Common and find and report on all of the Wombles found (ie the non-blank cells).

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Loops and conditions
Level: Average difficulty
Course: Excel VBA macros
Exercise: Loop over rows of data (rollercoasters) building up message displaying only wooden ones.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Referencing other applications
Level: Average difficulty
Course: Excel VBA macros
Exercise: Create a macro which opens a Word document and puts mail merge fields at the right bookmark locations.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Recording macros and buttons
Level: Average difficulty
Course: Excel VBA macros
Exercise: Record a macro to change the colours of various parts of a house - including adding command buttons.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Event handling
Level: Average difficulty
Course: Excel VBA macros
Exercise: Display various messages for a workbook after various events (eg trying to close the workbook, clicking on a cell).

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Visual Basic explained
Level: Average difficulty
Course: Excel VBA macros
Exercise: Name the VBA objects, collections, etc referenced in a screen shot, and write out some VBA commands.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Recording macros and buttons
Level: Average difficulty
Course: Excel VBA macros
Exercise: Record a macro to format a cell containing an elephant suitably, then strip out all of the unnecessary lines.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Average difficulty
Course: Excel VBA macros
Exercise: Write a macro to select a column of data, then amend it to select a rectangular block (both using the END keyword).

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Visual Basic explained
Level: Average difficulty
Course: Excel VBA macros
Exercise: Converting English sentences into Visual Basic, using properties, methods, objects and collections.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Average difficulty
Course: Excel VBA macros
Exercise: Use For Each loops to split a single table of data into three separate worksheets.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Average difficulty
Course: Excel VBA macros
Exercise: Change a team strip from green to (eg) red by looping over all of the cells in a range.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Referencing other applications
Level: Average difficulty
Course: Excel VBA macros
Exercise: Use the Microsoft Scripting Runtime object library and FileSystemObjects to manipulate files and open workbooks.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Loops and conditions
Level: Average difficulty
Course: Excel VBA macros
Exercise: Use If statements in Excel VBA to validate a set of user inputs in a Dating Agency workbook.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Harder than average
Course: Excel VBA macros
Exercise: Practise on a battleships grid using more difficult selection techniques, such as resizing a selection and using the UNION method.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Harder than average
Course: Excel VBA macros
Exercise: Loop over a set of mortgage deals and create an output file which compares them.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Harder than average
Course: Excel VBA macros
Exercise: Loop over all of the continent worksheets in a world workbook, going to the bottom cell on each, extracting the capital city name and listing on a separate sheet.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Harder than average
Course: Excel VBA macros
Exercise: Create macros to play hangman and to fill in a word search - two exercises in one!.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Forms
Level: Harder than average
Course: Excel VBA macros
Exercise: Get a macro to run when you open a workbook which creates a list of all of the worksheets and displays these in a form combo box for quick nvaigation.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Harder than average
Course: Excel VBA macros
Exercise: Generate unique hands of cards to deal a poker game in Excel.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Recording macros and buttons
Level: Harder than average
Course: Excel VBA macros
Exercise: Record a macro to apply data validation and protection to a cell, then strip out unnecessary lines.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Recording macros and buttons
Level: Harder than average
Course: Excel VBA macros
Exercise: Record a macro which will use a combination of absolute and relative cell referencing to add another period of data.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Selecting cells
Level: Harder than average
Course: Excel VBA macros
Exercise: Create a macro to select almost down to the bottom of a block of Muppets data (using OFFSET and END).

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Messages and variables
Level: Harder than average
Course: Excel VBA macros
Exercise: Use MsgBox to display a message asking user whether they want to continue or not, and process answer.

Go to exercise ...

Software: Excel VBA Macros
Version: Any version of Excel
Topic: Looping over collections
Level: Harder than average
Course: Excel VBA macros
Exercise: Create a game of hangman in VBA, to include lots of functions.

Go to exercise ...

You can search our full list of VBA exercises here.

This page has 0 threads Add post