Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto date/time input when click on cell in Excel XP

Status
Not open for further replies.

MAGICofSeth

Technical User
May 16, 2004
8
US
I have a spreadsheet that has several pages that all need the same function. When I click on a cell in the "A" column, I would like to have the current date and time entered into only that cell. Then, if I click on another cell in the "A" column, the next current date and time would be put into only that cell- and so on.

If anyone knows how to accomplish this, please post. Thank you for your help!!

-SO Lost-
Seth
 
Seth,

Could you live with selecting a cell and then pushing a menu button to populate the cell with the current date/time?

If so, here is the code behind the custom button:

Code:
Sub LetThereBeTime()
    ActiveCell.Value = Now()
End Sub
To create a custom button, right click on the white space around the toolbars at the top of the screen in Excel, then select "customize". From there "Commands" and then "Macro". Select the Smiley and drag him/her to the location on the toolbar that you would like. Right click on the Smiley and under assign macro select the LetThereBeTime sub.

Hope it helps,

Fred
 
Thank you for your help. I will give it a shot. I'm sure I dropped the code into the wrong spot because I couldn't make it work. I was able to make the button though! That will work out if I can't get the doubleclick method to work. Can you tell me where to put your code?
Thank You!!

--Seth
 
Seth,

In the VBA editor, select "Insert" and add a "Module". Copy and paste the code in the module and then go to the button and modify the assigned macro to "LetThereBeTime". It should show up in the list of macros to choose from.

Let me know if you have any problems, Fred.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top