我目前有这个代码:
Dim holrange1, holrange2 As Range
Dim holrange As Variant
Set holrange1 = Sheets("Resource Leave Plan").Range(holday & "4:" & holday & "103")
Set holrange2 = Sheets("Holidays").Range("B3:B202")
Set holrange = Nothing
Set holrange = Range(holrange1.Address & "," & holrange2.Address)
Worksheets("Schedule").Unprotect Password:="dfss"
Worksheets("Schedule").Cells(Target.Row, 7).Value = WorksheetFunction.WorkDay(strdt, noofdays, holrange)
其中strdt和noofdays是整数并且已经定义。我收到错误'无法获取WorksheetFunction类的WorkDay属性'。
我认为这是因为我已将变体holrange设置为两个不同工作表上的范围..
我怎样才能让它发挥作用?