Convert an Excel column number to its string equivalent
Author:Alan L. Lesmerises
Version Compatibility: Visual Basic 6, Visual Basic 5
This function returns the letter representation of an Excel column number. It converts the number to a string by first determining if the column uses one or two letters, then calculates the string equivalent using the CHR() function. Example: Columns 1-26 will be A-Z, 27-52 -> AA-AZ, 53-78 -> BA-BZ, etc. Note: The VBA code snippet "Get an Excel Column's Letter Representation from a Number" (ID=3503) is supposed to do the same thing, but has a bug in it. It does not return the correct column string for columns ending with "Z" (AZ is reported as BZ, BZ reported as CZ, etc.).
Instructions: Copy the declarations and code below and paste directly into your VB project.