VBA macros are going to history?

Some time ago, a client contacted me complaining that he could not open the report I sent him because it was blocked by the operating system. Indeed, I recently read a rumor that Microsoft plans to replace VBA with TypeScript macros in the recent future because they pose a security threat. It means that all files containing VBA code, downloaded from the Internet, are now blocked. How to solve this problem?

The Game of Life

The Game of Life is an old programmer’s puzzle that teaches teenagers to write and analyse their own code. The goal of the game is to simulate the development (life and death) of cells within one organism. An organism is a matrix of arbitrary size, and the rules are as follows: if a cell is alive and surrounded by 2 or 3 living cells, it will survive. If there is an empty position and is surrounded by 3 living cells, a new cell will be born. How to create this simulation in Excel?

Events

Running the VBA program is most often initiated by an event. Events can be on the document-level (eg Open, Activate), worksheet (eg Calculate, Change), charts, applications, forms … The event that starts the subroutine is mainly a click on a button or object, object focus or change the content of the object. Some events are executed automatically after opening an existing or creating a new document …

VBA filtering

Filters are a very useful functionality that enables us to filter content in the table or area above which the autofilter was previously used based on a given criterion. This can be accomplished in many ways, but there is always an event that we are launching to perform the action. In this “recipe” you will learn how to filter the table with the help of previously prepared, combo lists.

Coloring the content

Colors help us to emphasize the contents of the worksheet, and the VBA allows you to do so through the code. You can change the colors of the font, background or cell border. This can be done in several ways: by specifying a VBA constant representing color, by typing a color code or by specifying a RGB color combination using the same name function …