I am using some code which currently converts a number into the corrisponding column letter. eg 1 = A, 2 = B, 27 = AA, 56 = BD etc.
Here is the code:
If mycolumn > 26 Then
Mcl = Chr(Int((mycolumn - 1) / 26) + 64) & Chr(Int((mycolumn - 1) Mod 26) + 65)
Else
Mcl = Chr(mycolumn + 64)
End If
Where "mycolumn" = number & "Mcl" = letter.
This code will only calculate correctly for numbers up to 702 as this is ZZ.
How can i add onto this code to calculate for 3 letter column. eg AAA = 703, 4206 = EFT.
I cant seem to get my head around it.
Here is the code:
If mycolumn > 26 Then
Mcl = Chr(Int((mycolumn - 1) / 26) + 64) & Chr(Int((mycolumn - 1) Mod 26) + 65)
Else
Mcl = Chr(mycolumn + 64)
End If
Where "mycolumn" = number & "Mcl" = letter.
This code will only calculate correctly for numbers up to 702 as this is ZZ.
How can i add onto this code to calculate for 3 letter column. eg AAA = 703, 4206 = EFT.
I cant seem to get my head around it.