Results 1 to 8 of 8

ComboBox Time Value/Command button click update

Threaded View

hwtcrl ComboBox Time Value/Command... 04-29-2015, 06:30 PM
mehmetcik Re: ComboBox Time... 04-29-2015, 07:44 PM
LJMetzger Re: ComboBox Time... 04-29-2015, 08:04 PM
hwtcrl Re: ComboBox Time... 04-29-2015, 09:04 PM
mehmetcik Re: ComboBox Time... 04-30-2015, 12:38 PM
hwtcrl Re: ComboBox Time... 04-30-2015, 02:40 PM
LJMetzger Re: ComboBox Time... 04-30-2015, 05:32 PM
hwtcrl Re: ComboBox Time... 05-01-2015, 01:15 PM
  1. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: ComboBox Time Value/Command button click update

    Hi hwtcrl,

    Welcome to the joys of Excel time formatting. See the attached updated workbook. I changed the following:
    a. I changed your cells in Column 'A' to text format by putting an apostrophe in front of each value. Although Excel displays the values as text, it really stores the values as a real number 0 <= x < = 1 as a fraction of a day. e.g. 0.25 is 6AM.

    b. I changed the UserForm code to add the times and then convert them to display in PrettyPrint format:
    Label3.Caption = Format(CDate(TN + T1), "hh:mm:ss")
    Complete UserForm code follows:
    Private Sub ComboBox1_Change()
    
    Dim TN As Date, T1 As Date, TS As Date
    T1 = CDate(ComboBox1.Value)
    TN = CDate(Label2.Caption)
    Label3.Caption = Format(CDate(TN + T1), "hh:mm:ss")
    End Sub
    Private Sub ComboBox2_Change()
    
    Dim TN As Date, T1 As Date, TS As Date
    T1 = CDate(ComboBox2.Value)
    TN = CDate(Label2.Caption)
    Label4.Caption = Format(CDate(TN + T1), "hh:mm:ss")
    
    End Sub
    Private Sub ComboBox3_Change()
    
    Dim TN As Date, T1 As Date, TS As Date
    T1 = CDate(ComboBox3.Value)
    TN = CDate(Label2.Caption)
    Label5.Caption = Format(CDate(TN + T1), "hh:mm:ss")
    
    
    End Sub
    Private Sub CommandButton1_Click()
    
    Label2.Caption = Format(Now(), "hh:mm:ss")
    
    End Sub
    Lewis
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. use a command button to click other command buttons
    By fcharl9 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2013, 08:48 PM
  2. Automatically update existing data using a Update command button
    By 9999335 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 09:46 PM
  3. UserForm, update after command button click
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-01-2010, 01:05 PM
  4. VBA Click Command Button
    By Benz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-04-2006, 04:30 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