Convert the Excel Column Index to Letters

Category:
Office/VBA
Type:
Snippets
Difficulty:
Intermediate
Author:
Anonymous

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This code, given here as a function, will convert a column index number, given as an integer, to its corresponding column letter(s) returned as a string. The code can easily be placed in a macro without the use of a separate function by simply copying out the entire If statement. This applies to Excel 2003 AND 2007 and was inspired by the submission which didn't support the extended columns of Excel 2007, but is now included entirely within this function and is merely expanded upon.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: