+ Reply to Thread
Results 1 to 2 of 2

change a number when document is edited & saved

  1. #1
    Registered User
    Join Date
    01-03-2012
    Location
    Moz
    MS-Off Ver
    Excel 2010
    Posts
    1

    change a number when document is edited & saved

    Hello,
    Can someone tell me how do i do this in Excel:
    1. A field has a number for example 0001 which has to be protected, because it is a ref number.
    2. When the document is edited and saved, that field of point 1 has to increase to 0002.

    Thanks in advance

  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,509

    Re: change a number when document is edited & saved

    1. You'd protect the cell by locking it and protecting the sheet with a password. To update it, typically, the code would unprotect the sheet, increment the value and reprotect the sheet.

    2. You would increment the reference number in the Workbook Before Save event. Either include the code directly or call a subroutine in a standard module.


    I suggest you post a sample workbook for more specific assistance.


    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