excel vba function to convert column number to letter
Function ColName(n)
ColName = Split(Cells(, n).Address, "$")(1)
End Function
excel vba function to convert column number to letter
Function ColName(n)
ColName = Split(Cells(, n).Address, "$")(1)
End Function
excel vba column letter
Function ColumnLetter(pColIndex As Long) As String
ColumnLetter = Replace(Cells(1, pColIndex).Address(True, False), "$1", "")
End Function
excel vba column letter to number
Sub Test()
Debug.Print "result: " & getColIndex("DD") ' --> result: 108
End Sub
Function getColIndex(sColRef As String) As Long
Dim i As Long, sum As Long, iRefLen As Long
sum = 0: iRefLen = Len(sColRef)
For i = iRefLen To 1 Step -1
sum = sum + Base26(Mid(sColRef, i)) * 26 ^ (iRefLen - i)
Next
getColIndex = sum
End Function
Private Function Base26(sLetter As String) As Long
Base26 = Asc(UCase(sLetter)) - 64 'fixed
End Function
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us