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 ‘VBA’
Remove Filters in an Excel Sheet using VBA
Has your data import procedure ever failed due to users applying filters to the data? This happens quite often, especially when you have to distribute multiple files, which you intend to stack later. Copying filtered data copies only works on the visible cells; and you end up loosing out the hidden rows if the user applied a filter before saving the file. Let us take a look at how to remove filters from an Excel sheet from VBA, so you can copy the whole dataset.
Removing non-printing characters from text in Excel using VBA
Have you ever encountered a perfectly constructed MATCH or a VLOOKUP function failing for no apparent reason? Have you had […]
Is the WorksheetFunction property necessary in Excel VBA?
Excel’s Application object’s WorksheetFunction property is a container for Microsoft Excel worksheet function. This property returns a WorksheetFunction object that allows […]
Fit Worksheet to Window in Excel
Have you ever felt Excel needed a Fit-Document-to-Window-Width feature like the millions of PDF Readers out there? Wouldn’t it be […]
Duplicate a Sheet and retain a reference to it in Excel VBA
I recently worked on a project where my client had a Master template-sheet that needed to be duplicated and populated […]
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 Quickly Get A List All DAX Formulas From Your Excel 2010 PowerPivot Data Model
In this post, I describe a quick way to list all the DAX formulas in your PowerPivot for Excel 2010 Data model.
When do I use the Sheets Collection in Excel VBA?
There are two collections in Excel-VBA that lets the user access sheets in a workbook: the Sheets collection and the Worksheets collection. […]
Magically Select All The Used Areas In A Sheet using VBA
I recently published a post about automatically formatting a table in Excel using VBA. That got me thinking, how awesome it […]