How do I get column letter with API?
How do I get column letter with API?
(OP)
This is probably an easy one, but I've banged my head over it for a couple hours on at least a couple different days...How do I get column letter of the selected cell with API? I can get a number for the column (with cells), or the complete cell address (column letter and row number as one string). But how do I just get the column letter?
Thanks,
Ken
Thanks,
Ken
RE: How do I get column letter with API?
Private Sub CommandButton1_Click()
strfirst = IIf(Chr$(64 + ActiveCell.Column \ 26) = "@", "", Chr(64 + ActiveCell.Column \ 26))
strletter = strfirst & Chr$(64 + ActiveCell.Column Mod 26)
MsgBox strletter
End Sub
Get the column number, use Mod and Div to get the 2 parts, test for blank first letter and then concatenate.
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting
RE: How do I get column letter with API?
Thanks,
Ken