+ Reply to Thread
Results 1 to 8 of 8

How to get Time Difference

  1. #1
    Registered User
    Join Date
    03-07-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    182

    How to get Time Difference

    I have three Textbox.

    Textbox1 = Start Time < ---This will be generated by StartButton_click()

    Textbox2 = End Time
    Textbox 3 = Will be the time difference < -- This Texboxes2,3 will be generated by EndButton_click()

    Can someone help me to write this using excel VBA.

    Thank you!

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: How to get Time Difference

    Assuming this is on a userform:
    Please Login or Register  to view this content.
    Can someone help me...
    And you can try and understand how from the code.

  3. #3
    Registered User
    Join Date
    03-07-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    182

    Re: How to get Time Difference

    The value in Textbox3 are same with Texbox2 and it doesn't shows the correct time difference between textbox1 - textbox2

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: How to get Time Difference

    Try:-
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-07-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    182

    Re: How to get Time Difference

    Quote Originally Posted by MickG View Post
    Try:-
    Please Login or Register  to view this content.
    Thank you and it's working properly

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: How to get Time Difference

    You're welcome

  7. #7
    Registered User
    Join Date
    03-07-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    182

    Re: How to get Time Difference

    Can I ask one more?

  8. #8
    Registered User
    Join Date
    03-07-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    182

    Re: How to get Time Difference

    Good Day!

    I have a multiple checkbox with corresponding string on it, if the user check the first checkbox then click the submit button, the specific string will move to a specific Row(G5), but if the user check multiple checkbox the string will move to ROW(G5, G6, G7) depending on how many checkbox were check.

    Here is my code:
    Private Sub CommandButton4_Click()
    Dim RowCounter
    RowCounter = 0

    RowCount = Worksheets("Sheet1").Range("A1").CurrentRegion.Rows.count
    With Worksheets("Sheet1").Range("A1")
    If CheckBox1.Value = True Then
    .Offset(RowCount + RowCounter, 6).Value = .Offset(RowCount + RowCounter, 6).Value & vbCrLf & "Unable to remove footer"
    RowCounter = RowCounter + 1
    Else:
    .Offset(RowCount, 6).Value = ""
    End If
    If CheckBox2.Value = True Then
    .Offset(RowCount + RowCounter, 6).Value = .Offset(RowCount + RowCounter, 6).Value & vbCrLf & "Unable to use PMSectionHead as First Level header/section"
    RowCounter = RowCounter + 1
    Else:
    .Offset(RowCount, 6).Value = ""
    End If
    End With
    End Sub

    The only problem here if I check only 1checkbox the string doesn't transfer for first Available Row (G5).

    Thank you and hoping for a response.
    Last edited by N323100; 03-07-2017 at 09:58 AM.

+ 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] Time in Time format and text foramt - Finding the Hours difference
    By thilag in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-19-2013, 07:14 AM
  2. [SOLVED] Caculating the Time difference from Start & end date/time excludin weekends & non ofce hrs
    By Harry Jones in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-08-2012, 06:25 AM
  3. [SOLVED] Subtract date/time from data/time and get difference in minutes
    By zit1343 in forum Excel General
    Replies: 2
    Last Post: 06-18-2012, 11:23 AM
  4. Replies: 3
    Last Post: 03-02-2012, 08:18 PM
  5. Time Difference in hours between two date time stamps
    By Cipher in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-17-2010, 10:24 AM
  6. Calculating time difference between two days capturing the overnight time.
    By Monica_La in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-08-2007, 11:22 AM
  7. Negative time should be allowed in Excel, eg time difference
    By Bengt-Inge Larsson in forum Excel General
    Replies: 2
    Last Post: 10-13-2005, 08:05 AM

Tags for this Thread

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