Skip to content

Instantly share code, notes, and snippets.

@DavidMetcalfe
Last active May 13, 2020 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidMetcalfe/772a241283c7af819ecadbaf6bceae38 to your computer and use it in GitHub Desktop.
Save DavidMetcalfe/772a241283c7af819ecadbaf6bceae38 to your computer and use it in GitHub Desktop.
Convert between column numbers and column letters in Excel VBA
Function columnLetterToNumber(letter) As Long
' Convert a given column letter into the corresponding column number.
columnLetterToNumber = Range(letter & 1).Column
End Function
Function columnNumberToLetter(number) As String
' Convert a given column number into the corresponding column letter.
columnNumberToLetter = Split(Cells(1, number).address, "$")(1)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment