+ Reply to Thread
Results 1 to 5 of 5

How to convert column number to letter

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-08-2006
    Posts
    203

    How to convert column number to letter

    I need to select a range of cells based on a column number.


    myrow = 10
    
    mycol = myrow - 5
    
    ' How do I convert mycol to a letter so I can 
    
    myrange = mycol & myrow
    
    Range(myrange).Select
    Thank you
    Last edited by iturnrocks; 11-21-2007 at 09:51 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834
    1)
    myrow = 10
    mycol = myrow - 5
    Cells(myrow, myrow-5).Select
    2)
    myrow = 10
    mycol = Replace(Cells(1,myrow - 5).Address(0,0),"1","")
    Range(mycol & myrow).Select
    You don't need to "Select" the range most of the time, anyway.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834
    Quote Originally Posted by iturnrocks
    What Im trying to do is Select a larger range of cells like

    mycol = 5
    myrow = 5

    Range(mycol & myrow:mycol & myrow + 50).Select

    Does this make any sense?
    Cells(myrow, mycol).Resize(51).Select

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    iturnrocks

    Please read forum rules & wrap your VBA code

    A thread with the rules is available at the top of each forum or see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Forum Contributor
    Join Date
    08-08-2006
    Posts
    203
    If that "code" was actual code I would have wrapped it. That was only me trying to explain what I wanted to do. But I will go back and wrap it anyway.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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