ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do i assign cell A1 to show the current cursor cell in Excel? (https://www.excelbanter.com/excel-discussion-misc-queries/113852-how-do-i-assign-cell-a1-show-current-cursor-cell-excel.html)

OB

How do i assign cell A1 to show the current cursor cell in Excel?
 
I am trying to dynamically get the current cell address or the contents of
that cell in to one fixed cell (cell A1). When I move the cursor within the
worksheet, I would like the value of the cell A1 to reflect the new position
of the cursor cell (cell address) or the contents of that cell.

Gary''s Student

How do i assign cell A1 to show the current cursor cell in Excel?
 
Put the following in worksheet code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Target.Address
End Sub

--
Gary's Student


"OB" wrote:

I am trying to dynamically get the current cell address or the contents of
that cell in to one fixed cell (cell A1). When I move the cursor within the
worksheet, I would like the value of the cell A1 to reflect the new position
of the cursor cell (cell address) or the contents of that cell.


Jim May

How do i assign cell A1 to show the current cursor cell in Excel?
 
Paste this into the Sheet Module of the sheet in question:

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

You may also want to do a Freeze Pane in Cell A2;

HTH

"OB" wrote:

I am trying to dynamically get the current cell address or the contents of
that cell in to one fixed cell (cell A1). When I move the cursor within the
worksheet, I would like the value of the cell A1 to reflect the new position
of the cursor cell (cell address) or the contents of that cell.



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

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