+ Reply to Thread
Results 1 to 2 of 2

Thread: Making a settable clock in VBA in excel

  1. #1
    Registered User
    Join Date
    02-13-2010
    Location
    ny
    MS-Off Ver
    Excel 2007
    Posts
    1

    Making a settable clock in VBA in excel

    I need to make a clock that works off the system time when ran, but also has an option to set. It needs to have a set button, a reset button which makes it go back to system time, and buttons to change the hours and minutes separately. It also needs to display am/pm.

    I honestly have no Idea where to begin. If someone wants to make up a program for me I'd have no problem paying them for their time via paypal....But like I said any help is greatly appreciated.

    This is all I have so far.
    userform:
    Public Sub UserForm_Initialize()
    Do
    Call CurrentTime
    Loop Until CommandButton4.Enabled
    End Sub

    Public Sub UserForm1_Click()
    Do
    UserForm1.Label1.Caption = Hour(Now)
    UserForm1.Label2.Caption = Minute(Now)
    UserForm1.Label3.Caption = Second(Now)
    Loop Until CommandButton4.Enabled
    End Sub


    Public Sub CommandButton4_Click()
    Call settime
    End Sub


    Private Sub CommandButton1_Click()
    Dim x As Integer
    x = x + 1
    UserForm1.Label1.Caption = x
    End Sub

    Private Sub commandbutton2_click()
    Dim y As Integer
    y = y + 1
    UserForm1.Label2.Caption = y
    End Sub

    Private Sub commandbutton3_click()

    UserForm1.Label1.Caption = Hour(Now)
    UserForm1.Label2.Caption = Minute(Now)
    UserForm1.Label3.Caption = Second(Now)
    End Sub




    module 1

    Sub CurrentTime()
    UserForm1.Label1.Caption = Hour(Now)
    UserForm1.Label2.Caption = Minute(Now)
    UserForm1.Label3.Caption = Second(Now)

    Application.OnTime Time + TimeValue("00:00:01"), "CurrentTime"
    Format (LongTime)

    End Sub



    module2

    Sub settime()
    UserForm1.Label1.Caption = Int(0)
    UserForm1.Label2.Caption = Int(0)
    UserForm1.Label3.Caption = Int(0)
    End Sub

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

    Re: Making a settable clock in VBA in excel

    Welcome to the forum, ryan.

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

    Thanks.
    Microsoft MVP - Excel
    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.2.0