I'm trying to get date-type values from a given excel cell, however, my macro does not recognize cell values even though it's filled (date). Remember that there are three sheets.
With Worksheets("TEMP")
ActiveWorkbook.Sheets("TEMP").Activate
minDate = WorksheetFunction.Min(Worksheets("TEMP").Range("F2:F65000"))
maxDate = WorksheetFunction.Max(.Range(.Range("F2"), .Range("F65000")))
numMonths = 1 + DateDiff("m", minDate, maxDate)
If (numMonths < 3) Then
countMonths = 3
Else
countMonths = numMonths
End If
End With
The minDate and maxDate return as 0, just when I manually click on the cell and press Enter or click on another cell the macro recognizes, just that cell.
How to make the macro recognize that value?