1004无法获取工作表函数类的Workday_Intl属性

时间:2019-03-28 20:18:38

标签: excel vba

我不知道为什么我会在此代码中遇到1004 Runtime错误,并且可以使用一些帮助。

错误在这里发生:

rescDate = Application.WorksheetFunction.WorkDay_Intl(CloseDate, 3, 11, Holidays)

我尝试过的事情:

Option Explicit
Dim CloseDate as Date

CloseDate = GeneralInfo.Range("genCloseDate")

rescDate = Application.WorksheetFunction.WorkDay_Intl(CloseDate, 3, 11, Holidays)

AND

Option Explicit

    Dim wb as workbook
    Dim CloseDate as Range

    Set wb=MLAChecklist 'Codename of workbook
    set CloseDate = wb.GeneralInfo.Range("genCloseDate")

    rescDate = Application.WorksheetFunction.WorkDay_Intl(CloseDate, 3, 11, Holidays)

单步执行代码时,无论哪种情况,我都尝试过CloseDate变量的日期确实采用MM / DD / YYYY格式。

下面是目前的完整代码:

    Option Explicit
    Sub FundDateCalc()
        Dim CloseDate As Range, HolidayDates As Range
        Dim rescDate As Date, FundingDate as Date
        Dim LoanPurp As String

        Set HolidayDates = Holidays.Range("Holidays")

        Set CloseDate = GeneralInfo.Range("genCloseDate")

        rescDate = Application.WorksheetFunction.WorkDay_Intl(CloseDate, 3, 11, Holidays)

        FundingDate = Application.WorksheetFunction.WorkDay(rescDate, 1, Holidays)

End Sub

0 个答案:

没有答案