+ Reply to Thread
Results 1 to 10 of 10

Create a Digital Clock Segments Separated

Hybrid View

  1. #1
    Registered User
    Join Date
    01-21-2016
    Location
    Privato
    MS-Off Ver
    Office 2007
    Posts
    7

    Create a Digital Clock Segments Separated

    Good day to all of you my name is Maurizio and my problem with excel and this:
    Using a Userform I inserted three labels, now I would be able to understand how you can succeed in recreating a Digital Watch, making sure that the (Hour) are displayed in Label1; the minutes in Label2; and the second in Label3.
    Honestly speaking I thought that I needed only to write this code:

    Dim Sec, Min, Hour As Integer

    Hours = hour (Time)
    Min = minute (Time)
    Sec = second (Time)

    Me.Lbl_Ora.Caption VBA.Format = (Hours, "hh")
    Me.Lbl_Minuti.Caption = VBA.Format (Min, "mm")
    Me.Lbl_Secondi.Caption = VBA.Format (Sec, "ss")

    But as I see it is not.
    You have a vague idea of how to solve this problem Thank you.
    Greetings from A.Maurizio
    Attached Files Attached Files

  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: Create a Digital Clock Segments Separated

    Me.Lbl_Ora.Caption = Format(Hours, "00")
    Me.Lbl_Minuti.Caption = Format (Min, "00")
    Me.Lbl_Secondi.Caption = Format(Sec, "00")
    or (better)

      Dim t             As Date
    
      t = Time
      Me.Lbl_Ora.Caption = Format(t, "hh")
      Me.Lbl_Minuti.Caption = Format(t, "mm")
      Me.Lbl_Secondi.Caption = Format(t, "ss")
    Please use CODE tags when posting code. The forum rules explain how.
    Last edited by shg; 11-25-2016 at 02:43 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    01-21-2016
    Location
    Privato
    MS-Off Ver
    Office 2007
    Posts
    7

    Re: Create a Digital Clock Segments Separated

    Hello SHG listen: regarding Tag and true knew it, and I apologize, and was my forgetfulness, guaranteed that will not happen again.
    While for your help, I'm sorry but there's always that little Re: please you do not square.
    As far as concern the (Hour) and (Seconds) now work to wonder.
    Though itself tries to give a glance to the Label2 ie that of (Minutes) :

    Me.Lbl_Minuti.Caption = Format(t, "mm")
    What then, and this

    you would realize immediately that you have always the indicator (12), while in reality now dovrevve mark the number (24); Why and how can I fix this problem Thanks for your timeliness in responding and for your help.
    Greetings from A.Maurizio

  4. #4
    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: Create a Digital Clock Segments Separated

    I don't understand your question at all.

    Can you give an example of what you have and what you want?

  5. #5
    Registered User
    Join Date
    01-21-2016
    Location
    Privato
    MS-Off Ver
    Office 2007
    Posts
    7

    Re: Create a Digital Clock Segments Separated

    Hello Sorry for the Shg happened or not understanding of my request but honestly speaking I do not know the cause, and even I came out that way.
    Anyway my question was essentially this:
    When assessing your help I found that in the second label2, continues to come out in only number (12) while in reality should mark the number (07) being present you minutes.
    Why and how can I fix this problem Thanks

  6. #6
    Registered User
    Join Date
    01-21-2016
    Location
    Privato
    MS-Off Ver
    Office 2007
    Posts
    7

    Re: Create a Digital Clock Segments Separated

    Hello SHG listening: regarding Tag and true knew it, and I apologize, and it was my forgetfulness, guaranteed that it will not happen again.
    As for your help, I'm sorry, but there's always that little Re: please do not square.
    As with regard to the (now) and (seconds) now work wonders.
    Even if you try to take a look at Label2 namely to (minutes):
    Me.Lbl_Minuti.Caption = Format (t, "mm")
    What then, and this

    you should realize immediately that it always has the indicator (12), while in reality now dovrevve score the number (24); Why and how can I solve this problem Thank you for your promptness in responding and for your help.
    Greetings from A.Maurizio

  7. #7
    Registered User
    Join Date
    01-21-2016
    Location
    Privato
    MS-Off Ver
    Office 2007
    Posts
    7

    Re: Create a Digital Clock Segments Separated

    Hello Shg Listen please forgive me for asking again your intervention on my Digital Clock ..
    But fortunately I managed to find my old program that I created just one thing of this kind;
    Even itself at this juncture I I created a digital clock to seven Secmenti complete with Ringtone; date; etc....!
    For here I thank you for your help but All's Well That Ends Well no ...?
    Sincere Greetings and Happy weekend.

    (P.S) To correct my edit and then was this:
    * Private Sub UserForm_Initialize ()
    * Dim Hours, Min, Sec As Integer
    *
    ** Hours = hour (Time)
    ** Min = minute (Time)
    ** Sec = second (Time)
    **
    ** Me.Label1.Caption = Format (Hours, "0.0")
    ** Me.Label2.Caption = Format (Min, "0.0")
    ** Me.Label3.Caption = Format (Sec, "0.0")
    end Sub

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,459

    Re: Create a Digital Clock Segments Separated

    Try this,

    Me.Lbl_Minuti.Caption = Format (t, "nn")
    The help on Format says,

    Display the month as a number without a leading zero (1 – 12). If
    m

    immediately follows
    h

    or
    hh

    , the minute rather than the month is displayed.
    mm Display the month as a number with a leading zero (01 – 12). If
    m

    immediately follows
    h

    or
    hh

    , the minute rather than the month is displayed.
    it goes on to describe time formats
    h Display the hour as a number without leading zeros (0 – 23).
    Hh Display the hour as a number with leading zeros (00 – 23).
    N Display the minute as a number without leading zeros (0 – 59).
    Nn Display the minute as a number with leading zeros (00 – 59).
    S Display the second as a number without leading zeros (0 – 59).
    Ss Display the second as a number with leading zeros (00 – 59).
    Cheers
    Andy
    www.andypope.info

  9. #9
    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: Create a Digital Clock Segments Separated

    Quote Originally Posted by Andy
    Nn Display the minute as a number with leading zeros (00 – 59).
    Doh! Thank you, Andy.

    Quote Originally Posted by A.Maurizio
    All's Well That Ends Well
    Indeed, no thanks to me. Glad you got it sorted.

  10. #10
    Registered User
    Join Date
    01-21-2016
    Location
    Privato
    MS-Off Ver
    Office 2007
    Posts
    7

    Re: Create a Digital Clock Segments Separated

    Hello Shg Listen Because he never Done, For I could Courtesy Indicate how I Put and Where to Find, The (Fixed)
    Thanks For This Post

    Then at the same time I would like to know if I wanted to know my place a project in this Forum a purely Didactic purpose without many pretensions.
    I would upset qualquno I can Do it Liberamete.
    If so Fosse also here you tell me How To Thank.

    (P.S) I explain better I like to recreate or Create Healthy Plant also certain programs with your help.
    At the same time I think that putting my programs in the Forum, I might in some ways be of help to other people; How, in turn, I asked you, that's all.
    Tell me your opinion and let me know the dafarsi, I do not offend me.
    Whatever your Will.

    Cia You're a friend. A.Maurizio
    Last edited by A.Maurizio; 11-27-2016 at 01:56 PM.

+ 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] Please how to create a digital clock
    By Mart Marti in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-03-2015, 05:46 PM
  2. Creating a Digital Time Clock
    By tapsmiled in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-05-2015, 04:14 PM
  3. Need a Digital clock in Excel
    By neckbone30 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 01:11 PM
  4. Digital clock on excel
    By shilpz in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-13-2012, 12:15 PM
  5. Digital Alarm Clock
    By cascao in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2012, 05:55 AM
  6. Digital Alarm Clock
    By cascao in forum Excel General
    Replies: 1
    Last Post: 06-07-2012, 04:19 AM
  7. Timer in cell (digital clock)
    By most_lost in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 04-18-2012, 01:10 AM

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