Category Archives: Functions

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

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

IsNumeric in VBA: 8 Ways to Use the Function

In VBA, to test whether an expression is a number, the IsNumeric function can be used. Description The IsNumeric function evaluates whether the input expression is a number and returns a Boolean value (TRUE or FALSE). It returns True if the entire expression is a number; otherwise, it returns False. Syntax IsNumeric(expression) The

Rounding with VBA and Excel: Functions and Gotchas

VBA is often used for calculations – when you create these calculations, you can end up with a number that has multitude of decimal places.  The Round function in VBA lets you round the number to a set amount of decimal points, or to remove

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

How to use the RND Function in VBA

Introduction The RND function is used to generate a random number between 0 and 1. Generating a random number has applications in domains such as gambling, statistical sampling, computer simulation, or to — generally speaking — create unpredictable results for any other purpose. Of course,

No Thumbnail

VBA Arrays and Userdefined Functions and Subs

In this article I will cover the following topics: Passing Arrays as Input Parameters to Functions and Subs ByRef Passing Arrays as Input Parameters to Functions and Subs ByVal Getting the dimension of the Input Array to Function or Sub: Declaring Functions With an Array