+ Reply to Thread
Results 1 to 9 of 9

Time Stamp + Lock Functionality Macro

  1. #1
    Registered User
    Join Date
    10-11-2015
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    4

    Time Stamp + Lock Functionality Macro

    Hi All,

    This is my first post so please bear with me...

    Currently in work we have checklists that are time stamped, where the date, time and User ID is generated when clicked & we have a paperless template which has a lock functionality macro. The lock functionality macro button when clicked means no amendments can be done to the template from this point onwards. What I am trying to do is combine them both, a double lock functionality, so to speak.

    What I want is:
    - A macro where when the button is clicked first time a time stamp is generated somewhere on the page (with date, time and User ID) and then when 2nd clicked, the whole template is locked & preferable the time stamp from the 2nd click is also generated with this same information.

    Does anyone have any idea how to do this? We currently have Office 2010 in work.

    Thanks
    Rick

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Time Stamp + Lock Functionality Macro

    What you ask is probably quite simple.

    It depends on how you want to trigger the macros.

    Clicking on a button or in a specific cell or even on the second tab.

    It can also be triggered by double clicking or right clicking.

    The Date Stamp is easy, We would need to know the addresses of these.
    You would need to protect these cells so that the cannot be modified manually.
    Also easily done.

    The User ID would require the use of an input box, but you would need to check that the ID was valid.

    The second time the macro is triggered it would check for the first date stamp and if it existed it would

    Use an Input box and then protect all cells and lock the template with a password
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Time Stamp + Lock Functionality Macro

    This tests if the 1st time stamp cell is empty (cell A1 for this example).
    If true, then it logs the first time stamp in cell A1
    If filled already, it logs the second time stamp and locks the sheet.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    10-11-2015
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    4

    Re: Time Stamp + Lock Functionality Macro

    Thanks for the feedback.

    I want to trigger the macro by click on a button, not double clicking anywhere if possible. Currently we double click to generate the time stamp but I'm hoping got get this via a button. For the current time stamp macro, these cells are protected already so can only be altered with the password.

    I will get the coding we currently have tomorrow and post on this thread. I already have the macro time stamp coding, but I wouldn't know how to write the macro coding for: Initial time stamp generated in a certain cell; lock the template; and finally generate another time stamp in a different cell.

    I'm not sure what you mean by the addresses of these though...

  5. #5
    Registered User
    Join Date
    10-11-2015
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    4

    Re: Time Stamp + Lock Functionality Macro

    That is brilliant!

    Thank you. I'll try this tomorrow and potentially might have a few more questions from then!

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Time Stamp + Lock Functionality Macro

    You could also add code to the 1st click to change the Button's caption so the user knows the 2nd click is different.

  7. #7
    Registered User
    Join Date
    10-11-2015
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    4

    Re: Time Stamp + Lock Functionality Macro

    Great idea.

    I'll give it a go tomorrow in work. I do like the idea of the caption changing so the User knows what the click is entailing. I might struggle to be honest though with that! I'll attach the coding/spreadsheet to here tomorrow if I am having issues if you dont mind taking a look for me? Thanks again.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Time Stamp + Lock Functionality Macro

    No problem. I can take a look.

    It's a fairly basic question. Most anyone could probably get you the answer.

  9. #9
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Time Stamp + Lock Functionality Macro

    I have used five macros.

    The TimeStamp macro in a normal macro module:

    Please Login or Register  to view this content.
    The Cell Select, Double Click and Right Click macros are in the Template sheet
    Right click on Template at the bottom of excel and select view code.

    Please Login or Register  to view this content.

    Finally the last macro is in the Time Stamp Tab
    Seeing this is a bit more difficult select visual basic, view, select project and then click on sheet1.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Macro to date stamp cell below when text entered then password lock both cells
    By JohnDoh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2015, 10:20 AM
  2. Auto Lock after first Data Entry and Time Stamp
    By macpcboy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2015, 03:57 PM
  3. Time stamp, macro help!!
    By pasikowskij in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2013, 01:41 PM
  4. How do I lock a stamp date/time formula for an entry on a row?
    By PROPERTIES INC. in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-09-2012, 01:24 PM
  5. User to input character "A", but cell will show time stamp, and lock the cell.
    By matrix1108 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2012, 01:02 PM
  6. Auto Sort, Auto Lock, Auto Date & Time Stamp
    By suehatesyou in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2010, 02:57 PM
  7. Replies: 2
    Last Post: 09-30-2010, 04:20 PM

Tags for this Thread

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