Assigning one cell the value of another cell

Joined
Sep 22, 2010
Messages
2
This is probably basic for many/most of you, but I've been trying to figure out how to do this for a couple of hours now.....

Very simple, I have a spreadsheet with various values assigned to each cell. On top of the spreadsheet, I have a formula to calculate the result I am looking for. I would like to assign cell A1 with the value of whatever the value is for the cell within the spreadsheet that is currently hightlighted (e.g. cell D4 = 15, if I land the cursor on cell D4, I want cell A1 to automatically take on the value of 15.

Any help would be greatly appciated.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Right-click on the sheet tab and select View Code from the pop-up menu. Paste the code below in the VBA edit window.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    Range("A1").Value = Target(1).Value

End Sub
 
Upvote 0
Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Target.Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top