+ Reply to Thread
Results 1 to 8 of 8

ComboBox Time Value/Command button click update

Hybrid View

  1. #1
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: ComboBox Time Value/Command button click update

    Ok try this:

    
    Public TN As Date, T1 As Date, TS As Date, changeflag As Boolean
    
    Private Sub ComboBox1_Change()
    If changeflag = True Then Exit Sub
    
    ComboBox1.Value = Format(ComboBox1.Value, "hh:mm:ss")
    T1 = CDate(ComboBox1.Value)
    TN = CDate(Now)
    Label3.Caption = TN + T1
    Label3 = Format(Label3, "hh:mm:ss")
    
    End Sub
    Private Sub ComboBox2_Change()
    If changeflag = True Then Exit Sub
    
    ComboBox2.Value = Format(ComboBox2.Value, "hh:mm:ss")
    T1 = CDate(ComboBox2.Value)
    TN = CDate(Now)
    Label4.Caption = TN + T1
    Label4 = Format(Label4, "hh:mm:ss")
    
    End Sub
    Private Sub ComboBox3_Change()
    If changeflag = True Then Exit Sub
    
    ComboBox3.Value = Format(ComboBox3.Value, "hh:mm:ss")
    
    T1 = CDate(ComboBox3.Value)
    TN = CDate(Now)
    Label5.Caption = TN + T1
    Label5 = Format(Label5, "hh:mm:ss")
    
    End Sub
    Private Sub CommandButton1_Click()
    changeflag = True
    
    ComboBox3.Value = ComboBox2.Value
    ComboBox2.Value = ComboBox1.Value
    ComboBox1.Value = Format(Now, "hh:mm:ss")
    changeflag = False
    End Sub
    Attached Files Attached Files
    Last edited by mehmetcik; 04-30-2015 at 01:09 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  2. #2
    Registered User
    Join Date
    06-09-2011
    Location
    Denver
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: ComboBox Time Value/Command button click update

    Quote Originally Posted by mehmetcik View Post
    Ok try this:
    Let me restate the purpose of each entity.

    The command button should display time now() next to it (where it says <--Time Now) whenever the user clicks the button.

    Each combobox should display the user selected time in minutes, if they choose 5 in the first, 7 in the second, 10 in the third it should stay 5,7,10 and not change.

    The Time1-3 to the right of each combobox should display the computed time (time now value + combobox minute selection value) based upon the user combobox selections.

    No matter when the user clicks the command button the time now updates, as well as the computed times to the right of each combobox.

    The combobox values should never change unless the user changes them.

+ 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. 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