how to find which dates are lower and get its value one bye one in visual basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sivasweety
    New Member
    • Oct 2009
    • 7

    how to find which dates are lower and get its value one bye one in visual basic

    ' TD1 to TD18 to get date values one by one.

    Dim Fd1, Fd2, Fd3, Fd4, Fd5, Fd6, Fd7, Fd8, Fd9, Fd10, Fd11, Fd12, Fd13, Fd14, Fd15, Fd16, Fd17, Fd18 As Date

    Dim TD1, TD2, TD3, TD4, TD5, TD6, TD7, TD8, TD9, TD10, TD11, TD12, TD13, TD14, TD15, TD16, TD17, TD18 As Date

    Fd1 = CDate("04/07/2010")
    Fd2 = CDate("01/04/2010")
    Fd3 = CDate("31/03/2011")
    Fd4 = CDate("01/07/2010")
    Fd5 = CDate("30/06/2010")
    Fd6 = CDate("30/10/2010")
    Fd7 = CDate("20/02/2010")
    Fd8 = CDate("28/07/2010")
    Fd9 = CDate("04/08/2010")
    Fd10 = CDate("14/08/2010")
    Fd11 = CDate("19/09/2010")
    Fd12 = CDate("20/10/2010")
    Fd13 = CDate("12/07/2010")
    Fd14 = CDate("04/09/2010")
    Fd15 = CDate("13/06/2010")
    Fd16 = CDate("09/07/2010")
    Fd17 = CDate("03/12/2010")
    Fd18 = CDate("04/01/2011")

    The date always starting from 01/04/yr and always finishing from 31/04/year.
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    To begin with, your variables FD1 through FD17 are varients as are the variables TD1 through TD17 and the only ones declared as date are the last ones FD18 and TD18, which means you should declare your variables like...

    Code:
    Dim FD1 As Date, FD2 As Date, ...
    As for telling the difference between two dates, use the DateDiff Function...



    Good Luck

    Comment

    • sivasweety
      New Member
      • Oct 2009
      • 7

      #3
      Thank you Mr.vb5 prgrmr.

      Comment

      Working...