我正在自定义一个功能以根据日期列表验证工作日。我可以在2010年及更高版本中运行该功能,而在Excel 2007中却出现错误。请咨询
Function NSEBDay(InPut_Date As Date) As Date
Dim MyDate As Date
Dim Hday As Range
Set Hday = wksBackup.Range("TSys_NSEHoliday")
MyDate = Application.Evaluate("=workday(""" & DateAdd("D", InPut_Date, 1) & """,-1," & Hday.Address(0, 0, External:=True) & ")")
If InPut_Date = MyDate Then
NSEBDay = MyDate
Else
MyDate = Application.Evaluate("=workday(""" & InPut_Date & """,1," & Hday.Address(0, 0, External:=True) & ")")
End If
End Function