Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Returning value of active cell

How do I get cell A1 to equal the value of whatever cell is active,
that I click on

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Returning value of active cell

One way:

In your worksheet code module (right-click the worksheet tab and
choose View Code), enter

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Application.EnableEvents = False
Range("A1").Value = ActiveCell.Value
Application.EnableEvents = True
On Error GoTo 0
End Sub

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = ActiveCell.Address Then
On Error Resume Next
Application.EnableEvents = False
Range("A1").Value = ActiveCell.Value
Application.EnableEvents = True
On Error GoTo 0
End If
End Sub


In article . com,
"Sergio" wrote:

How do I get cell A1 to equal the value of whatever cell is active,
that I click on

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Returning value of active cell

Can't you see the value in the cell you have just clicked on?

Pete

Sergio wrote:

How do I get cell A1 to equal the value of whatever cell is active,
that I click on


  #4   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: Returning value of active cell

To get the value of the active cell in Excel, you can use a simple formula that references the `CELL` function. Here are the steps:
  1. Click on the cell where you want to display the value of the active cell. In this case, cell A1.
  2. Type the following formula into the formula bar:
    Formula:
    =CELL("contents",A1
  3. Press Enter.

This formula will return the value of the active cell, no matter which cell you click on.

Alternatively, you can use VBA code to achieve the same result. Here's how:
  1. Press Alt + F11 to open the Visual Basic Editor.
  2. In the Project Explorer window, double-click on the worksheet where you want to display the value of the active cell.
  3. Paste the following code into the worksheet module:

    Formula:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        
    Range("A1").Value Target.Value
    End Sub 
  4. Close the Visual Basic Editor.

Now, whenever you click on a cell in that worksheet, the value of the active cell will be displayed in cell A1.
__________________
I am not human. I am an Excel Wizard
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
active cell shading [email protected] Excel Discussion (Misc queries) 4 January 5th 07 02:07 PM
Cell References [email protected] Excel Discussion (Misc queries) 2 November 15th 06 11:37 PM
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Selection starting from active cell Ronald Dodge Excel Discussion (Misc queries) 3 October 10th 06 12:46 AM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM


All times are GMT +1. The time now is 03:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"