+ Reply to Thread
Results 1 to 9 of 9

Storing previous value in cell when data is changed

Hybrid View

  1. #1
    Registered User
    Join Date
    07-16-2008
    Location
    TO
    Posts
    18

    Storing previous value in cell when data is changed

    Hi,

    I have a value in A1 that continuously changes. However, after A1 has changed, I need the previous value in A1 to appear in A2 and when A1 changes again, I again need the previous value to appear in A2 and so on.

    For example, if A1=1 and it changes to A1=2, then I need A2=1. Then, if A1=3, I need A2=2, etc.

    I simply need the previous value in a particular cell to be stored in another cell. If somebody can help me with this problem it would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    08-10-2007
    Posts
    51
    Can I build the function by storing the previous value someplace on the worksheet or in another hidden worksheet? The problem is that I can't save the value in the memory after the function stops.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    It changes because you're changing it, or as a result of a formula, or something else?

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this
    Option Explicit
    
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        If Target.Address <> "$A$1" Then Exit Sub
        Dim OldValue
        OldValue = Target.Value
        Target.Offset(0, 1).Value = OldValue
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    07-16-2008
    Location
    TO
    Posts
    18
    what really happens is E53 is a user-entered value. then, because of that value, E56 changes due to the formula written in E56. Now after I change E53 to another value, I need the previous value of E56 to be stored in P56. SO i need the previous value of E56 to be stored in P56 (again E56 changes as the user-entered E53 changes). Any ideas? Any help would be greatly appreciated. I really have no idea how to use VBA =(

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Have you at least tried the example code to see if it is anyhing like what you wan/ You should really only need to change the cell references.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1