Closed Thread
Results 1 to 21 of 21

Recording/Logging Cell Value When Value Changes

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Recording/Logging Cell Value When Value Changes

    Hi all, this has been stumping me for awhile.

    Is there a way to copy/transfer a cell value to an adjacent cell when the value of the cell changes. So if A1= 5, and it changes to 3, have
    B2 = 5 when this happens.

    Thanks.

    bdb
    Last edited by bdb1974; 05-19-2009 at 04:20 PM.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Recording/Logging Cell Value When Value Changes

    It can be done with a Woksheet Change event macro

    Is A1 the only cell that this is to occur for?
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    No actually it will be for about 863 or so cells. Not all cells will have value changes. I don't know if it would be better (more efficient) to transfer all data to a second column regardless if a change occurs, or just have it so
    data transfers for each cell that actually has a change. I think I'd rather have it to where only the cells having a change in value gets moved over. I maybe getting ahead of myself, but, it would also be nice if the next column could
    log the date of the changed event for the cell to the left. Anyway, it will be a huge step for me if I just get the first
    part working.

    - bdb
    Last edited by bdb1974; 05-09-2009 at 12:21 AM.

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Recording/Logging Cell Value When Value Changes

    The code can add the date the cell was changed

    can you give examples of the range of cells you want to track the changes

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Recording/Logging Cell Value When Value Changes

    maybe you could store the previous value in a cell comment, unless you need it in other calculations
    Hope that helps.

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

    Free DataBaseForm example

  6. #6
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    Mudraker, Here's an example sheet.

    The range would be B6:B867, When A occurs to a cell within that range, the current value of that cell will me to column D, and the date of change will be
    in column E for the repective row.

    I'd like to be able to track the last few consecutive changes to an cell value.
    So, I created another group of columns to the right. So, maybe when D changes a 2nd time, it's value along with the respective date can be copied
    to I and J. Plus I'd like to copy the values and dates from columns F&G to K&L. I've got a macro I'm planning on placing on the page that will upadte the date in G for an entry in F.

    Roy UK, If I understand you correctly,that would be alot of manual labor to store each value in a comment and then have to move the mouse cusor over
    each cell to view the last value. I need this to be automated as much as possible.

    Hope this makes sense.

    Thanks,

    bdb
    Attached Files Attached Files

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Recording/Logging Cell Value When Value Changes

    The comment could be added/updated using code when the cell changes

  8. #8
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    Can you or Mudraker please post an example for the change of event macro. I do not know much about writing VBA code.

    Thanks,

    bdb

  9. #9
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Recording/Logging Cell Value When Value Changes

    this example is not built for our situation
    It places date in column b when a1 to a8 changes

    I don't have the time to look at your problem in detail at the moment as it will need to take into account removing the oldest tracked data when it gets over the number of changes you are tracking, moving the kept changes to the left before adding the latest change

    'These instructions pre typed & are worded to cater for the novice programmer
    'To install macro to correct location

    'Copy the macro
    'GoTo Excel
    'Select sheet this macro is to apply to
    'Right Click on Sheet Name Tab > select View Code
    'Paste macro into the Worksheet Module displayed

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    Thanks for the posting for the insertion of the date. But, my main problem
    is getting the values within the range transferred to another column before
    any changes occurs to them.

    bdb

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Recording/Logging Cell Value When Value Changes

    Can I ask why you need to do this?

  12. #12
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    Several reasons. I'm tracking and comparing records of quantities of the same item from two sources. The first source for quantity is from what's in inventory according to data entered into the purchasing inventory software database. The second source physically counts quantities to ensure system count is correct. Sometime theres quantities on hand that does not ever get placed back into the system. With my excel program, I'm able to bring in the system's inventory quantity. Each time this information is updated and there is a change in the inventories record, I have no way to update the physical yard count to match the ongoing change or difference in quantity count. By knowing the difference/change, I can use the difference in count and apply it to the physical count to keep it accurate. Also, knowing the difference each time there's a change, I'll be able to track the activitiy of how often items are being used/charged out and the quantity's being used each time. I'll better able to assess my needs and usage of materials if I know the history of our materials activity.


    Thanks,

    bdb

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Recording/Logging Cell Value When Value Changes

    This code will record the previous value in Column B in Column D, adding the date to E.
    Please Login or Register  to view this content.
    I'm not clear where else you want to save changes to

  14. #14
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    Roy, Thanks!

    I had to make a few changes to get the values from B to transfer to D.
    without iterations/looping. But the change I made seems to have fixed
    the problem. I tried adding a bit more code to get F to transfer to K, so
    far it's not working.

    Here's the current code:

    Please Login or Register  to view this content.
    Do I need:

    Please Login or Register  to view this content.
    ...being that more than 1 row may have a change in value?
    Last edited by bdb1974; 05-10-2009 at 08:26 PM.

  15. #15
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Recording/Logging Cell Value When Value Changes

    Not sure what looping you needed. This amendment will record changes in Column B to In D, changes in Column F to K

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    Is There any reason why this will not work in Excel. 2003 properly?

    I can't seem to get it function here at work.

    Thanks,

    bdb

  17. #17
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Recording/Logging Cell Value When Value Changes

    It was written in Excel 2003

  18. #18
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    I'm posting an example of what I'm trying to do.
    The change of events will not work with a input from a formula.
    It has to happen by manual input / vba code. I've got code to try to
    bring it qty's from a sheet named "Inventory_GUS" column "Y".

    So for, I'm not able to get it to work.
    Here's the code:
    Please Login or Register  to view this content.
    End Sub



    Any help is appreciated.

    Thanks,

    bdb
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Recording/Logging Cell Value When Value Changes

    Roy UK and Mudraker,

    Thanks Mudraker for letting me know it can happen.

    Thanks RoyUK for writing some code. What you have provided does work in itself. The only problem I have is getting now getting the initial values into
    the page by some other means (meaning VBA). Manual entering of values is not an option because I have to many. As I think I have read and also
    have experienced, a "Change of Events" macro/formula will not work when the actioning value in brought into a cell by another formula. I am hoping to
    be able to work this problem out. If not, I will hope that I can get some
    more experienced help here to figure how to ultimately get it to work with my workbook program.

    Thank again guys,

    bdb

  20. #20
    Registered User
    Join Date
    05-15-2012
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Recording/Logging Cell Value When Value Changes

    The last code is nearly perfect for what I need except I am not manually inputting the data, it is being calculated as the result of a formula. I tried changing the the first line to;

    Private Sub Worksheet_Calculate() (I took this from another post)

    ...but it didn't work. You may have already guessed I am a complete...lets say novice

    Any help would be much appreciated.

    Matt

  21. #21
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Recording/Logging Cell Value When Value Changes

    Matt,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed 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