sDate is STRING, which is not a real date!
Convert your string to a date using either the CDate () function or the DateValue () function.
However, there is a reservation to this transformation. These transformations will process the following structures:
yyyy/mm/dd yyyy/m/d mm/dd/yyyy m/d/yyyy
They will not be converted correctly
dd/mm/yyyy d/m/yyyy
And avoid using a two-digit year.
I would suggest using the DateSerial () function to convert the date.
So, regarding your code, assuming that the values ββon the yor sheet are actual dates (to be sure, just select the column and change the number format to GENERAL. If these are real dates, each of them will display PURE NUMBER. Press UNDO to get the format dates).
Dim result As Boolean If Worksheets("dates").Cells(1, 1).Value - Date > 30 Then result = True Else result = False End If
source share