Microsoft Excel lets you create your own custom functions, which are generally called user defined functions (UDFs). These are Function procedures inside a module with the VBA code that performs the necessary operations or calculations. They are very similar to the conventional Sub procedures, the main difference being that the Function procedures (and the UDFs) return a value. But they can also return several values. In this post we see how to create a function that returns an array of values.
Wednesday, April 16, 2025
Sunday, December 22, 2024
Range Data Into Array Excel VBA Macro
Arrays are used to store sets of data. A range with data in Excel can be stored in a two-dimensional (2D) array. A column or row are also Range objects and have by default 2 dimensions (one of which has only one element – either the column or the row). In this post we see how to put data from a range into a 2D array, and data from a single column or row into a 1D array.
Tuesday, May 24, 2022
Sort Elements In Array Excel VBA Macro
In a previous post we have seen how to sort text or words inside a single cell in the Excel worksheet using VBA macros. But that approach worked only with a list of unique values. In this post, we see how to sort the elements in the array created from the cell content, regardless whether that content has unique or repeated values. In both cases, the Split VBA function is used to convert the text or values into an array of elements. In this example, the elements are words separated by a space, but the same method can be used for values separated by a comma, semicolon, or a line break, as in the second scenario of the previous post.
Popular Posts
-
In a previous post , we have seen how to send an email from Excel (via Outlook) using VBA macros. We can add as many recipients as needed se...
-
We can integrate Excel with other Microsoft Office applications using VBA. In this post we are going to see how to send an email from Excel ...
-
Excel offers filter options to easily narrow down the data. This macro example activates the filter option in VBA and copies the filtered da...
-
In this macro example, we compare two worksheets with data from two different versions of the same data set. Thus, we can see if there are a...
-
In this post we see how to compare two Excel workbooks with VBA macros. The macro checks if the number of worksheets matches, then compares ...
-
This macro runs a clock timer in Excel. The user can start/stop the time, and the clock shows minutes and seconds. It is a simple example ...
-
In this post we learn how to upload or export data from Excel to Google Sheets using VBA macros. The macro sends a HTTP request to POST the ...
-
In a previous post we saw how to Compare Two Worksheets in Excel using VBA macros. In this post we see how to compare two columns with data...
-
In a previous post, we saw how to insert a picture from the web in Excel: Insert Picture From Web URL . We can insert a local picture usin...
-
This macro example separates sheets into new workbooks, keeping the original workbook. Each new workbook takes the name of the sheet and con...


