+ Reply to Thread
Results 1 to 6 of 6

VBA to return the Column LETTER NOT Number

  1. #1
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    VBA to return the Column LETTER NOT Number

    I have the following code, used after searching through numerous forum articles, and this is STIll returning the column number, NOT the LETTER. I need the letter returned to store in a variable.

    Can anyone advise me on how to get this to return the column LETTER rather than the number?

    Please Login or Register  to view this content.
    Thoughts Excel Peeps?

  2. #2
    Registered User
    Join Date
    07-25-2012
    Location
    NJ, USA
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2010
    Posts
    5

    Re: VBA to return the Column LETTER NOT Number

    Here's VBA I have used - may not be the best solution, but it works:

    Please Login or Register  to view this content.
    Last edited by Cutter; 07-25-2012 at 08:38 PM. Reason: Added code tags

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: VBA to return the Column LETTER NOT Number

    Example
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: VBA to return the Column LETTER NOT Number

    jindon - THANK YOU THANK YOU THANK YOU, This is exactly what I was looking for. I never thought to try it through a function call. Works brilliantly.

    SimeyC - Thank you as well, however your's did not work for my scenario.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: VBA to return the Column LETTER NOT Number

    You are welcome.

    However, I'm not sure about what you are really trying to do though, you don't need to get the Col.Letter most of the cases.....

  6. #6
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: VBA to return the Column LETTER NOT Number

    True, but I have Range code in another module that I will be using the variable in, global variable obviously!. So in the range code below, I will be replacing the :M with :"& ACol &", etc. this will be used in a number of different workbooks and the columns will not always be the same, so I needed a way to dynamically find the columns, this was the only way I could figure out.

    Please Login or Register  to view this content.
    will now be

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-17-2012
    Location
    Texas, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VBA to return the Column LETTER NOT Number

    I dont remember where I ran into these but if you need to switch back and forth beween column numbers and letter the following functions are useful.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by Snoday; 07-25-2012 at 11:53 AM. Reason: Fixed code tag

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1