Excel Column


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

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.

    >>

    >



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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center