I am trying to find the column names from the numbers given. I was able to find a MS KB article (ref: http://support.microsoft.com/kb/833402) on that, and was able to successfully implement it.
The problem I am now facing is that after AZ the code lists A[ instead of BB, B[ instead of CA, B\ instead of CB, and so on. Any help in solving the issue will be highly appreciated.
Here is the code.
The problem I am now facing is that after AZ the code lists A[ instead of BB, B[ instead of CA, B\ instead of CB, and so on. Any help in solving the issue will be highly appreciated.
Here is the code.
Code:
Sub Button1_Click()
' Finding row name from numbers
Dim ConvertToLetter As String
test1 = 200
docount1 = 1
Do Until docount1 = test1
iCol = docount1
ConvertToLetter = ConvertToLetter1
Dim iAlpha, iRemainder As Integer
iAlpha = Int(iCol / 27)
iRemainder = iCol - (iAlpha * 26)
If iAlpha > 0 Then
ConvertToLetter = Chr(iAlpha + 64)
End If
If iRemainder > 0 Then
ConvertToLetter = ConvertToLetter & Chr(iRemainder + 64)
End If
Range("A" & docount1) = ConvertToLetter
docount1 = docount1 + 1
Loop
End Sub