For i = 0 To intGrossDays
dteCurrDate = dteStart + i
If Weekday(dteCurrDate, vbMonday) < 6 Then
'If FindItemInArray(dteHol, dteCurrDate) Then
MyNetWorkdays = MyNetWorkdays + 1
'End If
End If
Next i
End Function
Answer Sanch,
A couple of your lines have been commented out. As it stands now, your code will return the same result as NETWORKDAYS. To work properly, uncomment the 2 lines in your For loop:
If FindItemInArray(dteHol, dteCurrDate) Then
End If
If you try the function now, you will probably get an error, because it is looking for another function named "FindItemInArray." If you can go back to the page where you got this code look for a function named that. If you don't remember where you found this code, the following should work. I just wrote it and haven't tested it completely, but it should workL
Private Function FindItemInArray(RangeToSearch As Range, DateToFind As Date) As Boolean
Dim cel As Range
FindItemInArray = True
For Each cel In RangeToSearch
If cel = DateToFind Then
FindItemInArray = False
GoTo ExitEarly
End If
Next cel
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here