Consulting

Results 1 to 4 of 4

Thread: Date Calculation Inside TextBox Vba

  1. #1
    VBAX Regular
    Joined
    May 2009
    Posts
    76
    Location

    Date Calculation Inside TextBox Vba

    Please see if you can help me rewrite the code below. perhaps a select case or another method might accomplish what I'm trying to do.

     If UserForm1.Date2.Value >= UserForm1.Order1 Then
      UserForm1.Days1.Value = ""
      Exit Sub
      End If
    
     With UserForm1
              If .Order1 = "" Or .Due1 = "" Then
              .Days1 = ""
        End If
        End With
        
    With UserForm1
    If .Due1 >= .Order1 Then
    .Days1.Value = DateDiff("d", CDate(.TDate1.Value), CDate(.Due1.Value))
      End If
        End With
        
     With UserForm1
            If .Extend1 >= .Order1 Then
            .Days1.Value = DateDiff("d", CDate(.Due1.Value), CDate(.Extend1.Value))
    End If
    End With
    
    With UserForm1
    If .Date2 = "" Then
    .Days1.Value = DateDiff("d", CDate(UserForm1.Order1.Value), CDate(UserForm1.Due1.Value))
    End If
    End With

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    If Date2 >= Order1 or Order1 = "" Or Due1 = "" Then Days1 = "" 
     
    If Due1 >= Order1 Then days1 = Duel-Tdate1 
    If Extend1 >= Order1 Then Days1 = Exten1- Duel
    If Date2 = "" Then Days1 = Duel - Order1

  3. #3
    VBAX Regular
    Joined
    May 2009
    Posts
    76
    Location
    I get the method or data member not found error message using
    sub tdater1()
    If Date2 >= Order1 Or Order1 = "" Or Due1 = "" Then Days1 = "" 
     
    If Due1 >= Order1 Then days1 = Duel-Tdate1 
    If Extend1 >= Order1 Then Days1 = Exten1- Duel 
    If Date2 = "" Then Days1 = Duel - Order1 
    end sub

  4. #4
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    Do some close reading.... (using F8 )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •