Public Function SpreadsheetHeaderToColumn(co As String) As Integer
co = co.ToUpper()
Dim ret As Integer = 0
For i As Integer = 0 To co.Length - 1
ret *= 26
ret += Char.GetNumericValue(co(i)) - 64
Next
Return ret
End Function
Public Function ColumnToSpreadsheetHeader(n As Integer) As String
Dim co As String = String.Empty
Dim m As Integer
While n > 0
m = (co - 1) Mod 26
co = Chr(Asc("A") + m) & co
n = (n - m) / 26
End While
Return co
End Function
DigitalDan.co.uk