I often need to determine the ordinal indicator (st/nd/rd/th) associated with a number, especially when I am working with dates. In this post, we will learn to write a simple user defined function in VBA, which will identify the ordinal indicator of an integer. Since the logic is quite straightforward, let us see how we can use the different control structures available in VBA.
Tag Archive for ‘User Defined Functions’
Are you Sure? Get user’s consent before running a Macro in Excel VBA for Beginners
This post is about getting the user’s permission before running a procedure, using the MsgBox function.
How to deal with the Numbers Stored As Text Error in Excel?
How many times have you encountered the “Numbers Stored as text” error in your data sets? It interferes with your LOOKUP and MATCH […]
Get the Actual Used Range in a Spreadsheet
In one of my posts, I wrote about the UsedRange property of the Worksheet object. I use it in almost all […]
Concatenate Unique Cells, with Text Formatting
A fellow struggler requested me to help him with a slightly beefed up Range Concatenate function. He needed to combine a […]
Clean a string for Range Names – Regular Expressions
I am a big fan of using named ranges in my VBA code. It makes referring to cells in formulas […]
Excel Worksheet Functions and VBA Functions
Many excel users might not be aware of the subtle distinction between Excel Worksheet functions and VBA functions. Majority of […]
Reversing a string in Excel
In my many years of rummaging through the internet for help, I have seen countless posts where troubled help seekers […]
Concatenate Range and Retain Formatting
In one of my previous posts, I wrote a function to concatenate the values stored in all the cells of […]
An upgrade to the Text() function in Excel
Many of us are familiar with the Text() function. It comes in handy when you set up excel to draft […]