Get an Excel Columns Letter Representation from a Number

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

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This function gets the letter representation of an Excel column by passing it the number. It works by adding 64 to the number, and using this as the ASCII representation. Example: Column 2 should be B, so 2 + 64 = 66, and Chr(66) = B.

Thanks to Jeff Carlson for correcting a small bug in this routine.

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

Declarations:

Code: