DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4

Thread: Excel Column

  1. #1
    Srini Guest

    Excel Column


    Is there a method to find out the column name (like "A" , "AA" )
    for a cell in Excel rather than using the .Address and parse it to get the
    column name? When I try the activecell.column it returns
    the column number.

    Any help is appreciated.

    Thanks,
    -Srini.

  2. #2
    Jim Cone Guest

    Re: Excel Column


    Srini,
    The shortest way I know is:

    Left$((ActiveCell.Column).Address(False, False)), 2 + (ActiveCell.Column
    < 27))

    Jim Cone
    *****************************************************
    "Srini" <srinit74@yahoo.com> wrote:
    >
    >Is there a method to find out the column name (like "A" , "AA" )
    >for a cell in Excel rather than using the .Address and parse it to get the
    >column name? When I try the activecell.column it returns
    >the column number.
    >
    >Any help is appreciated.
    >
    >Thanks,
    >-Srini.



  3. #3
    srini Guest

    Re: Excel Column


    Jim

    Thanks for the reply.

    I guess , you meant

    Left$(ActiveCell.Address(False, False), 2 + (ActiveCell.Column < 27))

    right??

    Thanks again,
    Srini.


    "Jim Cone" <jim_cone@my-deja.com> wrote:
    >
    >Srini,
    >The shortest way I know is:
    >
    >Left$((ActiveCell.Column).Address(False, False)), 2 + (ActiveCell.Column
    >< 27))
    >
    >Jim Cone
    >*****************************************************
    >"Srini" <srinit74@yahoo.com> wrote:
    >>
    >>Is there a method to find out the column name (like "A" , "AA" )
    >>for a cell in Excel rather than using the .Address and parse it to get

    the
    >>column name? When I try the activecell.column it returns
    >>the column number.
    >>
    >>Any help is appreciated.
    >>
    >>Thanks,
    >>-Srini.

    >



  4. #4
    Jim Cone jim_cone&my-deja.com Guest

    Re: Excel Column


    Srini,

    Sorry, the word "Columns" was omitted.
    Note that ".Address(False,False)" removes the absolute cell references ($)
    so then you only need the first character if the column number is less than
    27 and the first two characters otherwise.
    A corrected example follows:

    Sub WhatIsColumn()
    Dim ColName As String
    ColName = Left$(Columns(ActiveCell.Column).Address(False, False), 2 + (ActiveCell.Column
    < 27))
    MsgBox ColName
    End Sub

    ***********************************************************************
    "srini" <srinit74@yahoo.com> wrote:
    >
    >Jim
    >
    >Thanks for the reply.
    >
    >I guess , you meant
    >
    >Left$(ActiveCell.Address(False, False), 2 + (ActiveCell.Column < 27))
    >
    >right??
    >
    >Thanks again,
    >Srini.
    >
    >
    >"Jim Cone" <jim_cone@my-deja.com> wrote:
    >>
    >>Srini,
    >>The shortest way I know is:
    >>
    >>Left$((ActiveCell.Column).Address(False, False)), 2 + (ActiveCell.Column
    >>< 27))
    >>
    >>Jim Cone
    >>*****************************************************
    >>"Srini" <srinit74@yahoo.com> wrote:
    >>>
    >>>Is there a method to find out the column name (like "A" , "AA" )
    >>>for a cell in Excel rather than using the .Address and parse it to get

    >the
    >>>column name? When I try the activecell.column it returns
    >>>the column number.
    >>>
    >>>Any help is appreciated.
    >>>
    >>>Thanks,
    >>>-Srini.

    >>

    >



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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links