How do I stop the Now() function from updating everytime I open the file?

I need it to automatically grab the value of current time at a particular moment when the user does a specific action (like pressing a button maybe). The thing is, I need it to keep that value of time and not continue to update is as it generates new registrys in the rows below it.

What I'm trying to get is an Excel workbook that logs and keeps track of the time that my employees get to work, reason for which I dont want the user inputing the value of time but rather just pressing a button in a user form and the computer automatically generating and storing that data for later use by the admin.

The problem is that the Now() function always updates to the current time.

Help is appreciated!

3

2 Answers

That is the function of now(), to give the current time.

What you need is some simple VBA to return the current date/time when a button is pressed.

You don't say what version of Excel. For 2010/2013 you will need to turn on the Developer tab in the Ribbon and ensure that you set Excel to allow running macro's.

From the developer tab, inset a "Button (Form Control)". Give it a new Macro to work with.

Put in the following code:

Sub Button1_Click() Application.ActiveCell.Value = Now()
End Sub

It inserts the current date/time as a fixed value in the currently selected cell.

Make File->Option->Formulas->Calculation options as Manual

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like