I have a couple of dates I am passing to a user defined function. One date is causing the error whilst the vba is fine with the other...
The error only occurs when Excel is started up. When I stop the code running and run the function again, its fine!?
The date which VBA is fine with:
The date VBA doesn't like:
Both dates look fine (visually on the spreadsheet).
Simply defining the UDF is causing the error, regardless of whether I use the dates or not:
As I said, this only happens on Excel startup. It runs fine once the I force the code to stop running and call the function again...
Any help would be greatly appreciated.
Thanks
The error only occurs when Excel is started up. When I stop the code running and run the function again, its fine!?
The date which VBA is fine with:
Code:
'These values are set in the Formulas "Name Manager"
'SETTING_SEARCH_RELEASED_MONTHS_LATEST =3
'SETTING_SEARCH_NEXTMONTH_STARTDAY =14
'[LAST UPDATE] = 27/06/2019
[TO]=IF([LAST UPDATE]<>"",DATE(YEAR([LAST UPDATE]),MONTH([LAST UPDATE])-SETTING_SEARCH_RELEASED_MONTHS_LATEST+IF(DAY([LAST UPDATE])>=SETTING_SEARCH_NEXTMONTH_STARTDAY,1,0),1)-1,"")
The date VBA doesn't like:
Code:
[MOST RECENT]=DATE(YEAR(NOW()),MONTH(NOW())-SETTING_IMDB_SEARCH_RELEASED_MONTHS_LATEST+IF(DAY(NOW())>=SETTING_IMDB_SEARCH_NEXTMONTH_STARTDAY,1,0),1)-1
Both dates look fine (visually on the spreadsheet).
Simply defining the UDF is causing the error, regardless of whether I use the dates or not:
Code:
=GetLink([TO],[MOST RECENT],[RATING],[VOTES])
Public Function GetLink(pDateTo As Date, pDateRecent As Date, pRating As String, pVotes As String, Optional pLanguages As String = "", Optional ByVal pNoOfRecords As Integer = 250) As String
'pDateFrom As Date,
Dim result As String
GetLink = result
End Function
As I said, this only happens on Excel startup. It runs fine once the I force the code to stop running and call the function again...
Any help would be greatly appreciated.
Thanks