How to automate calculations of net working days with VBA in Excel. During project management we often need to calculate the net working days that we will have to complete the project. Therefore the subtraction of holidays including weekends from the working days is necessary to give us an exact idea of the days available. Watch the training video:
Watch the video on YouTube.
Here is the complete VBA macro code:
Dim lastrow As Long
lastrow = Sheets(“sheet1”).Range(“A” & Rows.Count).End(xlUp).Row
For i = 2 To lastrow
‘Cells(I,4) alone would also work
Cells(i, 4).Formula = Application.WorksheetFunction.NetworkDays(Cells(i, 2), Cells(i, 3))