Consulting

Results 1 to 4 of 4

Thread: Solved: Matching Date Types

  1. #1

    Solved: Matching Date Types

    Both MutliArr(abc, 2) and at show the same date, but the MultiArr(abc,2) has the date in parenthesis, and thus they never execute the "then" statement. Any suggestions?

    Thank you very much,

    Matt

    at = CDate(Application.Run("EOMONTH", iDte, 0))

    For ACounter = 1 To DataCount
    MultiArr(ACounter, 2) = Format(Cells(ACounter, 2).Value, "mm/dd/yyyy")
    Next ACounter


    iDte = Now()
    at = CDate(Application.Run("EOMONTH", iDte, 0))

    If MultiArr(abc, 2) = at Then ....

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    How does your array gets filled with the values ? You must compare strings with strings and dates with dates. Before filling the place in the array, store the info in a variable declared as date and put that variable in the array.

    Charlize

  3. #3
    The data in the cells is imported via sql query, and when I look at 'Format-Cells' they have custom values m/d/yyyy h:m



    For ACounter = 2 To DataCount + 2
    MultiArr(ACounter, 2) = Format(Cells(ACounter, 2).Value, "mm/dd/yyyy")
    Next ACounter

  4. #4
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Just a try-out. Don't kill me if it won't work.
    [VBA]Sub new_way()
    Dim feed_date As Date
    For ACounter = 2 To DataCount + 2
    feed_date = Format(Cells(ACounter, 2).Value, "mm/dd/yyyy")
    MultiArr(ACounter, 2) = feed_date
    Next ACounter
    End Sub[/VBA]Charlize

Posting Permissions

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