ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I get the coordinates of the active cell in Excel? (https://www.excelbanter.com/excel-discussion-misc-queries/146795-how-do-i-get-coordinates-active-cell-excel.html)

Jim Stuart

How do I get the coordinates of the active cell in Excel?
 
I want to find the row and column numbers of the active cell so that I can
use them as variables in an Excel worksheet.

ExcelBanter AI

Answer: How do I get the coordinates of the active cell in Excel?
 
To get the coordinates of the active cell in Excel, you can use a combination of the ROW and COLUMN functions. Here's how:
  1. Select the cell where you want to display the coordinates.
  2. In the formula bar, type the following formula:
    Code:

    =ROW()&", "&COLUMN()
  3. Press Enter.

This formula will return the row and column numbers of the active cell separated by a comma and a space. For example, if the active cell is A1, the formula will return "1, 1".

You can also use this formula in other cells to reference the row and column numbers of the active cell. For example, if you want to display the value of the cell one row below the active cell, you can use the following formula:
Code:

=INDIRECT(ROW()+1&","&COLUMN())

Rick Rothstein \(MVP - VB\)

How do I get the coordinates of the active cell in Excel?
 
I want to find the row and column numbers of the active cell
so that I can use them as variables in an Excel worksheet.


I presume you mean in a macro...

TheActiveRow = ActiveCell.Row

TheActiveColumn = ActiveCell.Column

Rick

Jim Stuart[_2_]

How do I get the coordinates of the active cell in Excel?
 

Rick,
Looks helpful. Now I have to figure out how to write a macro.
Thanks,
Jim

"Rick Rothstein (MVP - VB)" wrote:

I want to find the row and column numbers of the active cell
so that I can use them as variables in an Excel worksheet.


I presume you mean in a macro...

TheActiveRow = ActiveCell.Row

TheActiveColumn = ActiveCell.Column

Rick


Stan Brown

How do I get the coordinates of the active cell in Excel?
 
Sun, 17 Jun 2007 11:30:00 -0700 from <?B?SmltIFN0dWFydA==?=
<Jim :
I want to find the row and column numbers of the active cell so that I can
use them as variables in an Excel worksheet.


Do you want these in a VBA macro or in a worksheet? In a worksheet,
=ROW() is the current row number and =COLUMN() is the current column
number.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/

Earl Kiosterud

How do I get the coordinates of the active cell in Excel?
 
Jim,

Since you said active cell, I presume you mean in VBA:

ActiveCell.Row or ActiveCell.Column

If you mean in a worksheet:

=ROW() OR COLUMN().

The above yields the row or column that the formula lives in.
--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Jim Stuart" <Jim wrote in message
...
I want to find the row and column numbers of the active cell so that I can
use them as variables in an Excel worksheet.




Jim Stuart[_2_]

How do I get the coordinates of the active cell in Excel?
 

Earl, Stan,
I am working in Excel and don't know much about Visual Basic or Macros.
Rick has given me a response which would probably help me if I did, but the
fact is I can't make it work.

ROW() or COLUMN() just give the coordinates of the cell that the formula is
written in.
I want to know the current coordinates of the cell that the "cursor" is in.
The values should change as I use the arrows to move around the worksheet.
Thanks,
Jim

"Earl Kiosterud" wrote:

Jim,

Since you said active cell, I presume you mean in VBA:

ActiveCell.Row or ActiveCell.Column

If you mean in a worksheet:

=ROW() OR COLUMN().

The above yields the row or column that the formula lives in.
--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Jim Stuart" <Jim wrote in message
...
I want to find the row and column numbers of the active cell so that I can
use them as variables in an Excel worksheet.





Rick Rothstein \(MVP - VB\)

How do I get the coordinates of the active cell in Excel?
 
I am working in Excel and don't know much about Visual Basic or Macros.
Rick has given me a response which would probably help me if I did, but
the
fact is I can't make it work.

ROW() or COLUMN() just give the coordinates of the cell that the formula
is
written in.
I want to know the current coordinates of the cell that the "cursor" is
in.
The values should change as I use the arrows to move around the worksheet.


I think you will need to tell us more than you have about how you plan to
use this information. The reason your question, as stated so far, is
confusing is that you seem to want to "see" the active cell's row and column
while in the worksheet... but "active cell" is always being displayed in the
field located next to the formula bar, so you have to have something
"deeper" in mind with your question.... I think we are just having trouble
seeing what it is.

Rick


Jim Stuart[_2_]

How do I get the coordinates of the active cell in Excel?
 
Rick,
That's the frustrating part. I can see the information I want in the upper
left corner of the worksheet, but I can't use it in calculations.
I plan to display list of items on a workwheet where the user can scroll
through them using the cursor or arrows.
For each item there is an associated description that I want to display in a
separate part of the worksheet. If I could get the row and column of the
cell that the user is looking at at the moment, I could use that information
to look up the description.
I'm surprised that there isn't an Excel function that does this.
Thanks again,
Jim

"Rick Rothstein (MVP - VB)" wrote:

I am working in Excel and don't know much about Visual Basic or Macros.
Rick has given me a response which would probably help me if I did, but
the
fact is I can't make it work.

ROW() or COLUMN() just give the coordinates of the cell that the formula
is
written in.
I want to know the current coordinates of the cell that the "cursor" is
in.
The values should change as I use the arrows to move around the worksheet.


I think you will need to tell us more than you have about how you plan to
use this information. The reason your question, as stated so far, is
confusing is that you seem to want to "see" the active cell's row and column
while in the worksheet... but "active cell" is always being displayed in the
field located next to the formula bar, so you have to have something
"deeper" in mind with your question.... I think we are just having trouble
seeing what it is.

Rick



Jim Stuart[_2_]

How do I get the coordinates of the active cell in Excel?
 

Rick, Earl, Stan,
I found my answer on another help topic as follows.

Copy this event in the sheet module

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Cells(Target.Row, Target.Column).Address(False, False)
End Sub

Works like a slingshot.

Thank you all for your help.
Jim

"Jim Stuart" wrote:

Rick,
That's the frustrating part. I can see the information I want in the upper
left corner of the worksheet, but I can't use it in calculations.
I plan to display list of items on a workwheet where the user can scroll
through them using the cursor or arrows.
For each item there is an associated description that I want to display in a
separate part of the worksheet. If I could get the row and column of the
cell that the user is looking at at the moment, I could use that information
to look up the description.
I'm surprised that there isn't an Excel function that does this.
Thanks again,
Jim

"Rick Rothstein (MVP - VB)" wrote:

I am working in Excel and don't know much about Visual Basic or Macros.
Rick has given me a response which would probably help me if I did, but
the
fact is I can't make it work.

ROW() or COLUMN() just give the coordinates of the cell that the formula
is
written in.
I want to know the current coordinates of the cell that the "cursor" is
in.
The values should change as I use the arrows to move around the worksheet.


I think you will need to tell us more than you have about how you plan to
use this information. The reason your question, as stated so far, is
confusing is that you seem to want to "see" the active cell's row and column
while in the worksheet... but "active cell" is always being displayed in the
field located next to the formula bar, so you have to have something
"deeper" in mind with your question.... I think we are just having trouble
seeing what it is.

Rick




All times are GMT +1. The time now is 02:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com