+ Reply to Thread
Results 1 to 8 of 8

[SOLVED]Last updated cells

  1. #1
    Registered User
    Join Date
    06-24-2019
    Location
    Sweden
    MS-Off Ver
    Office 16
    Posts
    49

    [SOLVED]Last updated cells

    Hey

    I need a little help with this if its possible to do without some addon or something:

    excel.jpg


    I've managed to make C1 to show when the whole sheet was updated recently with LastModified() formula.


    Function LastModified() as Date

    LastModified = ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")

    End Function



    But what I need is C1 to show only when A1 OR A2 was recently updated.

    Thanks alot!
    Last edited by wizzan1; 07-07-2019 at 12:46 PM.

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Last updated cells

    You can do this using the Worksheet Change event.
    Right-click on the sheet name (the tab at the bottom) and select 'View Code' - this will open the VBEditor.
    Copy the code below and paste into the area on the right:
    Please Login or Register  to view this content.
    This will put the time now into C1 whenever A1 or B1 is changed. I think you mean A1 or B1, from your picture - if you mean A1 or A2, as you typed later, then change Range("A1:B1") to Range("A1:A2").

    You will need to save the file as a macro-enabled file (.xlsm).

    Hope that helps.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  3. #3
    Registered User
    Join Date
    06-24-2019
    Location
    Sweden
    MS-Off Ver
    Office 16
    Posts
    49

    Re: Last updated cells

    Quote Originally Posted by Aardigspook View Post
    You can do this using the Worksheet Change event.
    Right-click on the sheet name (the tab at the bottom) and select 'View Code' - this will open the VBEditor.
    Copy the code below and paste into the area on the right:
    Please Login or Register  to view this content.
    This will put the time now into C1 whenever A1 or B1 is changed. I think you mean A1 or B1, from your picture - if you mean A1 or A2, as you typed later, then change Range("A1:B1") to Range("A1:A2").

    You will need to save the file as a macro-enabled file (.xlsm).

    Hope that helps.


    Hey!

    Yes I meant A1:B1 you're right. I've now entered the macro you gave me and I've enabled macros in my file. What do I have to type into C1 to show the date and time whenever A1:B1 is updated? The cell is blank right now and shows nothing.

    Regards!

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Last updated cells

    Hi wizzan,

    Here is an attached that will update in column C for any changes in A or B.

    VBA Change Date and Time in Col C.xlsm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    06-24-2019
    Location
    Sweden
    MS-Off Ver
    Office 16
    Posts
    49

    Re: Last updated cells

    Quote Originally Posted by MarvinP View Post
    Hi wizzan,

    Here is an attached that will update in column C for any changes in A or B.

    Attachment 630913

    Hi MarvinP

    Thanks for the file and I've tried it it works fine! In my case it gives me an error, I might have missed something (im a beginner..)

    Attachment 630924


    I this case I want S4 to display whenever S2 or S3 is updated. I tried to change the code abit but didn't succeed.

    Best Regards

  6. #6
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Last updated cells

    Quote Originally Posted by wizzan1 View Post
    What do I have to type into C1 to show the date and time whenever A1:B1 is updated?
    You don't need to type anything into C1. The code will automatically put the time now into C1 whenever A1 or B1 is changed.

    Note, make sure that you have the code in the worksheet, not in a module. In the VB Editor, it should be in the code for 'Sheet1 (Sheet1)' or similar (if you've named the sheet, it will appear as 'Sheet1 (Summary)' or something like that).

    Edit: The cell format will be your default date and time format, until/unless you change that. You could have it show 'Last Updated: 5 jul 19 12:34:56' (for example) by using a custom number format like this:
    "Last updated: "d mmm yy hh:mm:ss
    That's the English format, the Swedish will be slightly different, depending on the abbreviations for day month etc.
    Last edited by Aardigspook; 07-05-2019 at 07:08 AM.

  7. #7
    Registered User
    Join Date
    06-24-2019
    Location
    Sweden
    MS-Off Ver
    Office 16
    Posts
    49

    Re: Last updated cells

    Quote Originally Posted by Aardigspook View Post
    You don't need to type anything into C1. The code will automatically put the time now into C1 whenever A1 or B1 is changed.

    Note, make sure that you have the code in the worksheet, not in a module. In the VB Editor, it should be in the code for 'Sheet1 (Sheet1)' or similar (if you've named the sheet, it will appear as 'Sheet1 (Summary)' or something like that).

    Edit: The cell format will be your default date and time format, until/unless you change that. You could have it show 'Last Updated: 5 jul 19 12:34:56' (for example) by using a custom number format like this:
    "Last updated: "d mmm yy hh:mm:ss
    That's the English format, the Swedish will be slightly different, depending on the abbreviations for day month etc.
    Thanks alot mate!

  8. #8
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Last updated cells

    You're welcome, glad we could help and thanks for the rep.

    If you're satisfied that your original question has been answered, then please take a moment to mark the thread as Solved so others know there's an answer here (instructions are in my sig). Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 11-11-2016, 09:07 PM
  2. Replies: 9
    Last Post: 02-12-2015, 03:53 AM
  3. Rev. Auto Updated when sheet is updated and or entire book
    By frankee_gee in forum Excel General
    Replies: 1
    Last Post: 04-07-2008, 05:05 PM
  4. Updated Cells
    By David French in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2005, 01:05 PM
  5. Updated cells
    By David French in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-27-2005, 02:05 PM
  6. Updated cells
    By David French in forum Excel General
    Replies: 0
    Last Post: 10-19-2005, 05:05 PM

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