PDA

View Full Version : Solved: Matching Date Types



mferrisi
04-09-2007, 10:33 AM
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 ....

Charlize
04-09-2007, 11:45 AM
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

mferrisi
04-09-2007, 12:00 PM
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

Charlize
04-09-2007, 12:14 PM
Just a try-out. Don't kill me if it won't work.
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 SubCharlize