VBA Formatting Cells

You can use macro in formatting cells, which involves using the Range Properties discussed earlier on. There are many properties we can use to edit cells, such as the cell size (the height, the width), cell color, font etc.

As an example, we will change the cell color to green if the inputted value is a number and bring a Notification if otherwise. Then also change the font of the cell.

Now, open another Editor window and add the following macros to the ones written in the previous example:

Fig 2.5 Macro for formatting cells
Fig 2.6 Macros for formatting, selecting, and populating selected cells

Some simple programming and VBA concepts were used in the macros above. Stuffs like IsNumeric; which checks if our input value is a number (Numeric). It is a method in Excel (it performs an action). Also, the “If End If” is a conditional statement and it is a programming concept to check the condition of a statement.

Leave a Reply

EXACT Function

The EXACT function compares two strings of text. The main limitation of using the Exact function is it is Case

Read More »
Scroll to Top