Why it can work in Function but ok in Sub
Can anyone tell me why the following code cannot work in Function but ok in
a Sub?
In Function, the statement
Workbooks("testing.xls").Activate
doesn't work, but ok in Sub
Thanks
Function no_of_HK_working_day(date1 As Date, date2 As Date, half_sat As
Double)
Set wb_current = ActiveWorkbook
Workbooks("testing.xls").Activate
Set wb_holiday = ActiveWorkbook
wb_current.Activate
End Function
|