All posts by Melanie Jenkins

Using the UCase Function in Excel VBA

There may be a time in Excel that you need data that you are fetching from an Excel spreadsheet or importing from external data to be amended to upper case.  This can, of course, be done manually, but if it is a large amount of

On Error…Go To: Error Handling in VBA

Even when your code is perfectly constructed, the user might not always do what you would expect.  For this reason, you need to insert error handlers into your code whenever there might be a reason that an error might occur. Handling an error when incorrect

How to Use the VBA Replace Function

The VBA Replace function is a function which you can use in your code to replace one set of string characters with another set of string characters, or to replace a set of string characters with an empty string. For example, you may have a

All About Dim Statements in VBA

A variable is a named storage location in which you can store information while your macro/program is running.  Each variable has a unique name where the name can identify what type of variable it is by using standard naming conventions.  A variable can contain different

A Complete Guide to Loops in VBA

When you write good VBA code, you try not to repeat yourself too often – in other words, you try not to write the same code for repetitive tasks more than once.  Looping structures are an invaluable part of VBA and you will use them

How to Use ByVal in VBA

Using the ByVal argument in VBA is a way to pass values to a function in VBA while retaining the original value of the variable. For example, you may have a list of names and dates of birth in your Excel sheet, and you wish

Entering a global variable

How Do Global Variables Work in VBA?

What is a Variable? When you are writing VBA code, you may need to store information at some point of your program that you may have need for at another point. For example, you may need to store the name of your company when you