+ Reply to Thread
Results 1 to 8 of 8

tracking changes

  1. #1
    Registered User
    Join Date
    04-08-2012
    Location
    scotland
    MS-Off Ver
    Excel 2007
    Posts
    4

    tracking changes

    Hi

    I am new to VBA and have been searching through a lot of threads but struggling to find what I need.

    I have in column B numeric values (in every other row ie in B2 B4 B6 etc)

    When the numeric value is changed in any of these cells i want to old value to appear in the same row.....

    for example when [B]2 is changed from 2 to a 1 i then want the number 2 to appear in cell C2 . when [B]2 is changed from 1 to a 4 i then want 1 to appear in cell D2....and so on

    is this easy enough to do?

    any help would be much appreciated

  2. #2
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: tracking changes

    Yeah that's doable.

    You'll need to use another column to store the value in as a temp memory, but if you make the font the same colour as the cell background (eg white) then users wont see it.

    Access the worksheet change event by right clicking on the sheet tab and selecting 'view code'.

    In there put:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: tracking changes

    Hi keeks45
    Welcome to the Forum!
    Try this code in the Worksheet Code Module. Every even numbered row in Column B will fire the code. You may need to adjust the Range of Column B cells that fire the code.
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    04-08-2012
    Location
    scotland
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: tracking changes

    aww thanks for all your help...it worked!

    is there anyway i could do a couple more things with this

    i have added a wee example to illustrate what i need

    Row 1 is the title row and will remain the same.

    The user will manually input the Title/owner and score (the date reviewed columnwill automatically update and i have this working)

    The history section i am looking to be automatically updated when the cells in the score column is updated.

    For example When the score in the cat row is changed from 5 to 10 the the number 5 will be added to the end (after the 7) and the date it was changed will be added directly above this. ideally i would like to see 10 changes worth of data so i can trend it.

    if anyone could help you would make my easter

    Title Owner Date Reviewed Score History
    01/02/2011 01/03/2011 01/04/2011
    Cat Brad 01/05/2011 5 4 6 7
    01/08/2011 05/08/2011
    Dog Sarah 01/09/20110 6 4 5
    Last edited by keeks45; 04-08-2012 at 02:50 PM. Reason: the example layout was not correct

  5. #5
    Registered User
    Join Date
    04-08-2012
    Location
    scotland
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: tracking changes

    ok release the example layout was changed

    let me try and explain

    row 1 is the title row and will remain the same

    columns A to D will have data manually inputted by the user
    rows 2,4,6,8,and so on will have dates that show the date of when a value has changed and what the value was underneath it

    so for example the user in cell D3 changes the value from 5 to 7 then the value 5 will be stored in E3 and the date it was changed will be in E2.

    then the user sometime later changes the value in D3 to 10 (from 7) then the number 7 will be stored in F3 and the date it happened in F2 and then when the user changes D3 then changes will be stored in 3 and so on.

    this will apply to cells D3, D5, D7 etc (not sure the limit but will apply to the odd rows)

    does this make it any clearer what i am trying to do lol

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: tracking changes

    Hi keeks45
    Two issues:
    1) In your Post#4 you said
    aww thanks for all your help...it worked!
    What "worked"...you have two solutions offered and no apparent indication of which you are using.

    2) In your Post #4 you posted sample data that is useless in it's current form; put the data into a workbook that has the same layout and structure of your actual file...perhaps then it'll make more sense. Even better, post your actual file with existing code and a before and after example of what you're trying to accomplish.

  7. #7
    Registered User
    Join Date
    04-08-2012
    Location
    scotland
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: tracking changes

    hey

    the second post worked. i just wanted to see if i could store an old value....if i could do that then i thought i could build on it for what i actually need.


    i am unable to post the file. is there a way to amend the code in the second post so the date is added in the cell above the old value to indicate when it was changed.

    thanks for all your help

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: tracking changes

    Hi keeks45
    If this is all you wish to do
    the date is added in the cell above the old value to indicate when it was changed.
    Then it's simply one line of code
    Please Login or Register  to view this content.

+ 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