+ Reply to Thread
Results 1 to 7 of 7

Automatically update date when a range of data is changed

  1. #1
    Registered User
    Join Date
    09-11-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    4

    Automatically update date when a range of data is changed

    Hello,

    I have an excel worksheet that contains columns A to J. Now I'd like to use column J to show the current date if I change any cell in column B to I (in the same row).
    On the forum i found a thread that told me how to do this for only one column, so if A is changed, B shows the updated date.
    The macro for this is:

    Col = Left(Target.Address, 2)
    If Col = "$A" Then Target.Offset(0, 1) = Now

    Can anybody give me advice on how to change these two lines for the purpose i just described?

    Many Thanks,

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Automatically update date when a range of data is changed

    How about this?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-11-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Automatically update date when a range of data is changed

    I tried to do it your way, but it doesn't work. Thanks for your advice anyway

  4. #4
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Automatically update date when a range of data is changed

    It works fine for me but then again I haven't seen the rest of your code.
    If you share some more info it should be no problem making it work. Delete things you don't want to share from your workbook and post it with just some sample data.
    Or just post more of the code.
    Last edited by Jacc; 09-11-2012 at 02:14 PM.

  5. #5
    Registered User
    Join Date
    09-11-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Automatically update date when a range of data is changed

    Hhmm would be way more easy to post my excel fil indeed. I added it in the attachment.

    Many thanks in advance

  6. #6
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Automatically update date when a range of data is changed

    Does this work for you?

    Note that the code is located in a Sheet module. Note also the "Worksheet" and "Change" in the dropdown menus. This setting will give you a Sub with the title
    Please Login or Register  to view this content.
    Any time a cell is changed on that worksheet this Sub will run and the cell that was changed will be available in the Target variable.
    The IF setting just makes sure the code only runs if the Target cell is before the "J" column and after the first row.Code in sheet module, Worksheet Change.PNG

    If you right click on a tab and choose Show Code, you will come directly here.

    Almost forgot to put the code on display as well

    Please Login or Register  to view this content.
    Last edited by Jacc; 09-12-2012 at 12:14 PM.

  7. #7
    Registered User
    Join Date
    09-11-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Automatically update date when a range of data is changed

    Jacc, works for me now! Might seem very easy, but I found it rather difficult to get used to the code..

    Thank you, thank you

+ 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