+ Reply to Thread
Results 1 to 5 of 5

Button to insert current time in active cell

  1. #1
    Registered User
    Join Date
    11-06-2012
    Location
    Cincinnati, Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Question Button to insert current time in active cell

    I am looking for a way to insert the current time in the active cell. I guess this would be done by clicking a button. Can someone give me a step-by-step explanation on how to do this or a step-by-step explanation of a better solution. I found one tutorial that I did not like that insert the current time in any cell I clicked in. This was not good because I would end up inserting the time in cells that did not intend to. I was thinking that clicking a button to insert the time in the active cell would give me the control I am looking for. I do not know hardly anything about working with developer tools so clear instructions would be appreciated.

  2. #2
    Forum Contributor
    Join Date
    09-23-2007
    Location
    Melbourne, Australia
    Posts
    176

    Re: Button to insert current time in active cell

    It's quiet simple. All you need to do is drag a button onto your spreadsheet and double click on it to bring up a wizard which will ask you to direct it to a macro or write a new one. You only have to add Activecell.value = time to the procedure and that's it.

    Search around the web for how to add a button to your spreadsheet. Also look up events to understand how a small procedure is run from that button.

    Example attached.



    Please Login or Register  to view this content.
    Time.xlsm
    Attached Files Attached Files
    Last edited by danny2000; 03-31-2016 at 10:12 AM.

  3. #3
    Registered User
    Join Date
    11-06-2012
    Location
    Cincinnati, Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Button to insert current time in active cell

    I'm thinking now that I want to do something different. Instead of putting a button on the spreadsheet, I think it would be better to have a macro in the ribbon. I created a ribbon called time with a group called current time and inserted a command macro called time into it which has the script that you provided

    Please Login or Register  to view this content.
    When I put the cursor in the cell where I want the current time inserted and click on the time macro in the ribbon, I get an error:

    Compile error:
    Expected Function or variable
    What am i doing wrong?
    Last edited by cinci-hal; 03-31-2016 at 06:25 PM.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Button to insert current time in active cell

    Change your Sub name. There is already a Function called time that is built-in to VBA. The very one you are using in your macro.
    Last edited by JOHN H. DAVIS; 04-01-2016 at 10:52 AM.

  5. #5
    Registered User
    Join Date
    11-06-2012
    Location
    Cincinnati, Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Button to insert current time in active cell

    Thank you for your help. I actually stumbled upon a solution that will work even better for me. I did not realize that there was a shortcut Ctrl+: that does what I want.

+ 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. [SOLVED] Create a button that adds current time into cell
    By miah in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-14-2015, 04:35 AM
  2. [SOLVED] Insert current date and time in a worksheet cell
    By wolfm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2014, 05:19 PM
  3. Double click cell to insert current Time
    By Vetequk in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2013, 10:30 AM
  4. Insert Date and Time Picker value into Active Cell
    By B. Baumgartner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2007, 01:45 PM
  5. [SOLVED] Macro to insert Current Time into protected cell
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2005, 06:05 AM
  6. Replies: 1
    Last Post: 03-22-2005, 03:06 PM
  7. [SOLVED] Adding a control button to insert a date in the active cell.
    By Mike in forum Excel General
    Replies: 2
    Last Post: 02-15-2005, 03:06 PM

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