×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How do I get column letter with API?

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
Replies continue below

Recommended for you

RE: How do I get column letter with API?

A bit hacky I'm afraid, but it works:

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?

(OP)
Excellent!  Works great!
Thanks,
Ken

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close