DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Find row and column of Selected cell

  1. #1
    Join Date
    Jun 2007

    Find row and column of Selected cell

    Priority Question:
    I need to get the Row and Column of a Selected Cell... The User selects the cell and the script needs to return to me the Row and Column.

    Also how do you convert Column 1 to Range Column A? to use from Cells(5,1) To Range("A5") ?


  2. #2
    Join Date
    Oct 2005
    Are you talking about working VB with excel ?

    If so, for your first question I think you could use the ActiveCell property of a worksheet object. With ActiveCell property you can get the property Row and Col for the row and column selected, like ActiveCell.Row or ActiveCell.Col.

    For your second question I'm not very sure how you want to handle it but you could use the ASCII code to do something like:

    col = var + 65

    where var would be the col in the form Cell(row,col), the you just can convert that number to character:


    and then concatenate the col_str with the number of row like:

    range = col_str & Trim(Str(row))

  3. #3
    Join Date
    Jun 2007
    Trim(Str(row)) I know what Trim does.. it removes spaces.. What is Str from?

    Is that a variable I have to find earlier? or is it a built in?

  4. #4
    Join Date
    Aug 2005

    Post Try this out

    Something with nmxnmx 's lead.
    try the given code for the 2nd Question

    Function getColName(colNumber As Integer) As String
     If colNumber >= 1 And colNumber <= 26 Then
        getColName = Chr(colNumber - 1 + 65)
        getColName = getColName(colNumber \ 26) & getColName(colNumber - 26 * (colNumber \ 26))
     End If 
    End Function
    Full functioning is with the attached excell file
    Attached Files Attached Files

Similar Threads

  1. help with sparse matrix
    By jrhaley123 in forum Java
    Replies: 8
    Last Post: 09-28-2013, 10:48 PM
  2. Replies: 1
    Last Post: 02-09-2006, 10:17 AM
  3. Datagrid - Highlight selected row
    By Dan Thibodeaux in forum .NET
    Replies: 1
    Last Post: 04-23-2002, 11:23 AM
  4. JTable Cell Editor
    By Jan Vettenburg in forum Java
    Replies: 1
    Last Post: 11-30-2001, 11:57 AM
  5. MSHFlexGrid: get column and row total?
    By Victor in forum VB Classic
    Replies: 1
    Last Post: 04-07-2000, 11:35 AM

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

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