+ Reply to Thread
Results 1 to 2 of 2

Auto Date Stamp - Disabled undo button

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2010
    Posts
    1

    Auto Date Stamp - Disabled undo button

    Hi Folks

    I found a great little piece of code which does exactly what I want in that if a cell in colum C to M is amended, it automatically updates column B with the date it was changed.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("C:M")) Is Nothing Then
    Cells(Target.Row, 2) = Date
    End If
    End Sub

    Problem is that I have noticed that any changes within columns C to M loses the undo history. cells outside of those paramters (i.e. columns N onwards) keep the history as long as nothing is changed in C to M. Is there a way of keeping the undo history by amending or adding to the above code?

    Cheers

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,251

    Re: Auto Date Stamp - Disabled undo button

    Unfortunately, that's the nature of macros / VBA code. As soon as you run a macro, it clears the Undo stack. The fact that you have an event monitor means that, as soon as one of those cells is changed, the Undo stack is cleared ... but it goes much further back than the most recent change. The cells that are outside the scope of the event monitor won't cause the event to be acted upon ... so you retain your capability to undo stuff.

    Not much you can do about it, I'm afraid.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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