Is there a more pythonic way of converting excel-style columns to numbers (starting with 1)?
Working code up to two letters:
This should do, in VBA, what you're looking for:
Function columnNumber(colLetter As String) As Integer
Dim colNumber As Integer
Dim i As Integer
colLetter = UCase(colLetter)
colNumber = 0
For i = 1 To Len(colLetter)
colNumber = colNumber + (Asc(Mid(colLetter, Len(colLetter) - i + 1, 1)) - 64) * 26 ^ (i - 1)
Next
columnNumber = colNumber
End Function
You can use it as you would an Excel formula--enter column, in letters, as a string (eg, "AA") and should work regardless of column length.
Your code breaks when dealing with three letters because of the way you're doing the counting--you need to use base 26.