Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to create an add-in with the following VBA code stored in it. It
references 2 ranges that have a list of dates for the networkdays function. The macro doesn't work if it is not the active worksheet. Public Function Busdays() Dim Break As Date Dim Recon As Date Dim strAnswer As VbMsgBoxResult strAnswer = MsgBox("Is this a xxx?", vbQuestion + vbYesNo, "Select Yes for xxx, No for yyy") If strAnswer = vbYes Then Break = InputBox("Enter the date of the break") Recon = InputBox("Enter the date of the recon") Busdays = networkdays(Break, Recon, Workbooks("busdays.xls").Worksheets("Sheet1").Rang e("XHolidays")) Busdays = Busdays - 1 Else Break = InputBox("Enter the date of the exception") Recon = InputBox("Enter the date of the recon") Busdays = networkdays(Break, Recon, Workbooks("busdays.xls").Worksheets("Sheet1").Rang e("YHolidays")) Busdays = Busdays - 1 End If End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
active cell address with worksheet function | Excel Worksheet Functions | |||
how to call a function procedure | Excel Programming | |||
procedure/function calling | Excel Programming | |||
Unable to set the active cell from within a VBA procedure | Excel Programming | |||
Worksheet change sub procedure | Excel Programming |