ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to Capture the initial value of a cell. (https://www.excelbanter.com/excel-programming/448429-need-capture-initial-value-cell.html)

dpk2307

Need to Capture the initial value of a cell.
 
HI,

I need to capture the initial value of a cell into another cell and store it permanently even if the parent cell value is changed any number of times.
For Ex: When the sheet was opened, say the A1 value was 25, then same should be assigned to B1, when I change A1 any number of times, still the B1 value should be 25 itself.

Ron Rosenfeld[_2_]

Need to Capture the initial value of a cell.
 
On Tue, 19 Mar 2013 10:50:24 +0000, dpk2307 wrote:


HI,

I need to capture the initial value of a cell into another cell and
store it permanently even if the parent cell value is changed any number
of times.
For Ex: When the sheet was opened, say the A1 value was 25, then same
should be assigned to B1, when I change A1 any number of times, still
the B1 value should be 25 itself.


You need to use VBA to do that. One way is with a worksheet selection_change event code.

To enter this event-triggered Macro, right click on the sheet tab.
Select "View Code" from the right-click drop-down menu.
Then paste the code below into the window that opens.

====================================
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, [a1]) Is Nothing Then
If [b1].Text = "" Then
[b1].Formula = "=IF(A1="""","""",A1)"
Else
[b1].Value = [b1].Value
End If
End If
End Sub
===============================


All times are GMT +1. The time now is 03:19 AM.

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