RSS

Download Excel VBA macro examples

From this page you can download Excel spreadsheets with VBA macro examples.

The files are zip-compressed, and you unzip by right-clicking (once the file is downloaded) and choose "Unpack" or whatever Windows suggests.

The spreadsheets exemplify some of the things I write about on this site, and to the right of each download link is a (www)-link that will take you to the corresponding webpage.

Once you have opened an Excel workbook, you can open the Visual Basic editor by pressing ALT+F11. I do not have a certificate, so you will probably need to select a low security level to run the macros.

The examples have all been made in Excel 2000 or 2003 (Danish version), and if they don't work in other versions it may be, that I have made mistakes, but it could also be a compatibility issue.

Automation error

Excel 2016 introduced a new bug: You get an error message, "Automation error", when you open (some) spreadsheets with macros made with Excel 2003 or older.

There are no problems running the macros, but the message is annoying. To make it disappear just save as a macro enabled workbook in the new format (*.xlsm).

Downloads:

Conditional formatting using macros   (www)

How to make calendars in Excel   (www)

Dependent ComboBoxes and arrays in class collection   (www)

Userform with calendar and date picker   (www)

Using worksheet functions on arrays   (www)

Delete rows by using criteria   (www)

Calculating time, stops etc.   (www)

Animated charts   (www)

Pareto charts   (www)

Making histograms in Excel with VBA   (www)

Using Excel's Solver with VBA   (www)

Merge data or tables   (www)

Combine tables   (www)

Fast text file import with Excel VBA macro   (www)

Make your own popup menu   (www)

Double-click as alternative to hyperlinks   (www)

Blinking cells   (www)

Hide rows and columns conditionally   (www)

Looping controls on a userform   (www)

How to make classes and class collections   (www)

Process and mass balance   (www)

Arrays and ranges   (www)

Ticket or number control   (www)

Find cells and insert hyperlinks   (www)