+ Reply to Thread
Results 1 to 2 of 2

Re: On select cell enter current time (range A1:A999)

  1. #1
    Registered User
    Join Date
    09-29-2009
    Location
    Stoke-on-Trent
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: On select cell enter current time (range A1:A999)

    I need to speed up data entry in a spreadsheet by adding some VBA code so that when a cell in a range (for example A1:A999) is selected the cell show the current time. I know this can also be achieved fairly quickly with keyboard shortcuts (i.e. Ctrl+Shift+ but would like to make the spreadsheet do it instead).

    Help!! I tried the following but it failed! Any suggestions??

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = 1 Then
    Cancel = True
    With Target
    .Value = Now
    .NumberFormat = "[h]:mm:ss"
    End With
    End If
    End Sub

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: On select cell enter current time (range A1:A999)

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then edit your post to add code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ 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