+ Reply to Thread
Results 1 to 9 of 9

Time drop down selector

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-12-2018
    Location
    Leesburg, FL
    MS-Off Ver
    2013
    Posts
    113

    Time drop down selector

    I'm working with time card data and I would like to be able to select a cell and have it provide a way to choose both the hour and minute. For example, one cell is time in: 8:01 am and another cell is time out 5:05pm. It doesn't necessarily need to be a drop down, I just want a way to select the time without having to type it in.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,272

    Re: Time drop down selector


    It can be without any macros.
    Attached Files Attached Files

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,442

    Re: Time drop down selector

    .
    Option Explicit
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = 11 Then 'MsgBox "column 11 is clicked"
        With Sheet1
            .Unprotect
            With Target
                .Font.ColorIndex = 4
                .Value = Environ("username") & " " & Format(Now(), "dd/mm/yyyy hh:mm:ss AM/PM")
            End With
            If CDbl(Time) > .Cells(Target.Row, 4) Then Target.Font.ColorIndex = 3
            .Protect
            Cancel = True
        End With
    End If
    If Target.Column = 12 Then 'MsgBox "column 11 is clicked"
        With Sheet1
            .Unprotect
            With Target
                .Font.ColorIndex = 4
                .Value = Environ("username") & " " & Format(Now(), "dd/mm/yyyy hh:mm:ss AM/PM")
            End With
            If CDbl(Time) > .Cells(Target.Row, 5) Then Target.Font.ColorIndex = 3
            .Protect
            Cancel = True
        End With
    End If
    End Sub
    Attached Files Attached Files

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Time drop down selector

    Late entry
    Click on cells in column A or B
    Dropdown appears, click on hour or minute figures to update.
    Confirm selection by clicking 'tick'
    Times transfered to target cell.
    torachan
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    10-12-2018
    Location
    Leesburg, FL
    MS-Off Ver
    2013
    Posts
    113

    Re: Time drop down selector

    Quote Originally Posted by torachan View Post
    Late entry
    Click on cells in column A or B
    Dropdown appears, click on hour or minute figures to update.
    Confirm selection by clicking 'tick'
    Times transfered to target cell.
    torachan
    This caused an error for me when running. Apparently I'm missing date time picker add-in, but I can't seem to install it. I followed the instructions online and it states it was successful, but it doesn't appear as drop down choice in the ActiveX controls.

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Time drop down selector

    I now remember this procedure being somewhat fiddly when I did it many years ago.
    It certainly took a number of steps to achieve something that should be intuitive to me.
    In the VBA editor can you check that you have at least the minimum boxes checked as per the attached screen captures.
    selecting Tools > References.
    CaptureRefs.JPG

    With a blank UserForm inserted and ToolBox visible right click on ToolBox in additional tools is DatePicker checked with a 'X'
    CaptureDTP.JPG

  7. #7
    Forum Contributor
    Join Date
    10-12-2018
    Location
    Leesburg, FL
    MS-Off Ver
    2013
    Posts
    113

    Re: Time drop down selector

    Quote Originally Posted by torachan View Post
    I now remember this procedure being somewhat fiddly when I did it many years ago.
    It certainly took a number of steps to achieve something that should be intuitive to me.
    In the VBA editor can you check that you have at least the minimum boxes checked as per the attached screen captures.
    selecting Tools > References.
    Attachment 618106

    With a blank UserForm inserted and ToolBox visible right click on ToolBox in additional tools is DatePicker checked with a 'X'
    Attachment 618107
    Torachan - Thank you for taking the time to do this. I have all the references except, Microsoft Windows Common Controls. I do not see it as a selectable option though for me. Based on your picture, it looks like it is related to mscomct2.ocx I found a Youtube video showing how to add this to Excel and followed the steps and it stated it was successful, but I still don't see common controls or date picker as options for me. I gave you some rep for your time. Thank you very much.

  8. #8
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Time drop down selector

    @bvwalker1
    Sorry you have had difficulty installing Date/Time picker.
    Consultation prize attached, my version of time picker.
    It should work as it only uses standard form elements.
    The userform is modeless enabling you to access sheet at the same time.
    If you close the timepicker it will reappear as you click in cells in columns A or B
    The timepicker floats near to selected cell as the sheet scrolls up.
    The time is relevant to the cell selected to enter the time click green button.
    Only use the picker for time entry, manual entry into 'IN' or 'OUT' cell will not compute across row.
    torachan
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    10-12-2018
    Location
    Leesburg, FL
    MS-Off Ver
    2013
    Posts
    113

    Re: Time drop down selector

    Quote Originally Posted by torachan View Post
    @bvwalker1
    Sorry you have had difficulty installing Date/Time picker.
    Consultation prize attached, my version of time picker.
    It should work as it only uses standard form elements.
    The userform is modeless enabling you to access sheet at the same time.
    If you close the timepicker it will reappear as you click in cells in columns A or B
    The timepicker floats near to selected cell as the sheet scrolls up.
    The time is relevant to the cell selected to enter the time click green button.
    Only use the picker for time entry, manual entry into 'IN' or 'OUT' cell will not compute across row.
    torachan
    Torachan - Thanks! This works great. It is exactly what I was after. You the man!

+ 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] Drop Down Form Date Selector - Excel 2013 64bit
    By Noob Saibot in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 07-22-2015, 09:06 AM
  2. Have a drop-down month selector on a sheet
    By excelneophyte15 in forum Excel General
    Replies: 10
    Last Post: 02-20-2015, 01:53 PM
  3. Replies: 8
    Last Post: 02-22-2008, 12:53 PM
  4. [SOLVED] Drop down list as part of a file name selector
    By Guido in forum Excel General
    Replies: 1
    Last Post: 05-25-2006, 02:15 PM
  5. [SOLVED] color selector
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2005, 03:05 PM
  6. selector
    By kwc in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-12-2005, 09:06 PM
  7. [SOLVED] selector
    By kwcarson in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-12-2005, 09: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